diff --git a/Application/Home/Controller/CoinOrderController.class.php b/Application/Home/Controller/CoinOrderController.class.php index e6e5002a0..5d1eadc39 100644 --- a/Application/Home/Controller/CoinOrderController.class.php +++ b/Application/Home/Controller/CoinOrderController.class.php @@ -99,6 +99,7 @@ class CoinOrderController extends BaseController } } $this->assign("LV",self::LV); + $config = $this->getOfflineConfig(); if(IS_POST){ SafeFilter($_POST); $coin_num = I("coin_num"); @@ -121,15 +122,22 @@ class CoinOrderController extends BaseController $data['pay_amount'] = bcadd($coin_num,$free,2); $data['order_status'] = 0; }else{ - $data['pay_amount'] = $coin_num; + if($config['is_open'] != 1) { + $this->ajaxReturn(['status'=>0,'info'=>'配置错误','time'=>1000],"JSON"); + } + + $data['pay_amount'] = sprintf("%.2f",$coin_num*($config['coin_discount']*10)/100); $collection_account = I("collection_account",""); $pay_order_number = I("pay_order_number"); - /*if($collection_account==''){ - $this->ajaxReturn(['status'=>0,'info'=>'请选择汇入银行','time'=>1000],"JSON"); - }*/ + $game_id = I("game_id", 0); + if($game_id < 1){ + $this->ajaxReturn(['status'=>0,'info'=>'请选择游戏','time'=>1000],"JSON"); + } + if($pay_order_number==''){ $this->ajaxReturn(['status'=>0,'info'=>'请输入支付凭证','time'=>1000],"JSON"); } + $is_order = M("coin_pay_order","tab_") ->where( array('pay_order_number'=>$pay_order_number, @@ -151,7 +159,9 @@ class CoinOrderController extends BaseController $data['remark'] = I("remark"); $data['voucher_img'] = $res['id']; $data['order_status'] = 2; - $data['pay_way'] = 3; + $data['pay_way'] = 4; + $data['game_id'] = $game_id; + $data['discount'] = $config['coin_discount'] * 10; } M("coin_pay_order", 'tab_')->add($data); recordPromoteLogs('平台币管理','提交充值订单'); @@ -163,9 +173,30 @@ class CoinOrderController extends BaseController $this->assign("account",$account); $this->assign("bank_list",$bank_list); $this->assign("discount","0"); + $this->assign("config", $config); $this->display(); } } + private function getOfflineConfig() + { + $config = M("Kv")->where("`key` like 'offline_platform_coin_%'")->getField('key,value',true); + $pid = session('promote_auth.pid'); + $sendArr = [ + 'is_open'=>0 + ]; + if(isset($config['offline_platform_coin_promote_ids'])){ + $promote_ids = explode(',', $config['offline_platform_coin_promote_ids']); + if(in_array($pid, $promote_ids)) { + $sendArr['is_open'] = 1; + } + } + if($sendArr['is_open'] == 1) { + $sendArr['game'] = M('Game', 'tab_')->where("id in ({$config['offline_platform_coin_game_ids']})")->getField('id,game_name'); + $sendArr['coin_discount'] = ($config['offline_platform_coin_discount']?:100) / 10; + $sendArr['collection_img_path'] = $config['offline_platform_coin_collection_img_path']; + } + return $sendArr; + } //订单明细 public function order_detail(){ diff --git a/Application/Home/View/default/CoinOrder/order_add.html b/Application/Home/View/default/CoinOrder/order_add.html index ca65fc73a..73b0505ad 100644 --- a/Application/Home/View/default/CoinOrder/order_add.html +++ b/Application/Home/View/default/CoinOrder/order_add.html @@ -30,8 +30,32 @@