diff --git a/Application/Sdk/Controller/ShortcutController.class.php b/Application/Sdk/Controller/ShortcutController.class.php index cf14b902..f7a022d2 100644 --- a/Application/Sdk/Controller/ShortcutController.class.php +++ b/Application/Sdk/Controller/ShortcutController.class.php @@ -665,6 +665,133 @@ class ShortcutController extends BaseController{ $this->other_price($request, $request['price']-$pay_amount); } + // 平台币充值 + if ($is_platform) { + $request['code'] = 0; + $request['user_id'] = I('request.user_id'); + $request['price'] = intval(I('request.price')); + $request['game_id'] = I('request.game_id'); + $request['pay_way'] = C("PAY_WAY.SQ_SHORTCUT"); // 支付方式(-1绑币 0:平台币,1:支付宝,2:微信(扫码)3微信app 4 威富通 5聚宝云 6竣付通 7苹果支付8金猪支付 9双乾支付-支付宝 10双乾支付-银联 15双乾支付-快捷 + $request['pay_status'] = 0; + $request['spend_ip'] = get_client_ip(); + + $payInfo['info'] = json_decode($payInfo['info'],true); + $request['goods_info'] = $payInfo['info']['game_name'].$payInfo['info']['body']; + + $payInfo = M('pay_info', 'tab_')->where([ + 'user_id' => I('user_id'), + 'game_id' => I('game_id'), + 'extend' => I('extend'), + ])->order('id desc')->find(); + $request['pay_order_number'] = $payInfo['order_id']; + + if (!$payInfo) { + return ; + } + } else { // 游戏充值 + $request['code'] = 1; + $payInfo = M('pay_info', 'tab_')->where([ + 'user_id' => I('user_id'), + 'game_id' => I('game_id'), + 'extend' => I('extend'), + ])->order('id desc')->find(); + if ($payInfo) { + $info = json_decode($payInfo['info'], true); + $info['deduction_amount'] = $request['deduction_amount']; + $info['actual_amount'] = $request['actual_amount']; + $info['discount_amount'] = $request['discount_amount']; + $info['price'] = $request['price']; + $infosave = json_encode($info); + + $info['code'] = $request['code']; + $info['pay_order_number'] = $request['pay_order_number']; + $request = $info; + $request['pay_way'] = C("PAY_WAY.SQ_SHORTCUT"); + $request['pay_status'] = 0; + $request['spend_ip'] = get_client_ip(); + $request['pay_order_number'] = $payInfo['order_id']; + $payInfo['info'] = json_decode($payInfo['info'],true); + $request['goods_info'] = $payInfo['info']['game_name'].$payInfo['info']['body']; + } + } + + $this->assign("pay_amount", $request['actual_amount']?$request['actual_amount']:$request['price']); + $this->assign("user_id", $request['user_id']); + $this->assign("game_id", $request['game_id']); + $this->assign("user_token", $userToken); + $this->assign("extend", I('extend')); + $this->assign("order_id", $request['pay_order_number']); + $this->assign('goods_info',$request['goods_info']); + + + $this->display(); + + } + + public function yee_step2() { + $is_platform = 0; + if (I('request.code') == 0 && I('request.type') == 'platform') { + $is_platform = 1; // 平台币充值 + } + + //$prefix = ($is_platform == 1) ? 'PF_' : 'SP_'; + //$request['pay_order_number'] = $prefix . date('Ymd') . date('His') . sp_random_string(4); + $request['game_id'] = I('request.game_id'); + $game_id = $request['game_id']; + $request['user_id'] = I('request.user_id'); + $user_id = $request['user_id']; + $request['code'] = I('request.code'); + + $payInfo = M('pay_info', 'tab_')->where([ + 'user_id' => I('user_id'), + 'game_id' => I('game_id'), + 'extend' => I('extend'), + ])->order('id desc')->find(); + + $request['price'] = $payInfo['price']; + + $userToken = I('request.user_token'); + + if (empty($request)) { + redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'is_platform'=> $is_platform,'msg'=>'登录数据不能为空', 'user_token' => $userToken)));exit; + } + // 支付验证 是否让支付 + $payCheck = pay_check($request['user_id']); + if (!$payCheck['code']) { + redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'is_platform'=> $is_platform,'msg'=>$payCheck['msg'], 'user_token' => $userToken)));exit; + } + + $game = M('Game','tab_')->where(['id'=>$request['game_id']])->field('pay_status')->find(); + if($game['pay_status'] == 0){ + redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'is_platform'=> $is_platform,'msg'=>'该游戏暂时无法充值,请联系客服!', 'user_token' => $userToken)));exit; + } + if($request['price']*1<=0){ + redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'is_platform'=> $is_platform,'msg'=>'充值金额有误', 'user_token' => $userToken)));exit; + } + + C(api('Config/lists')); + + if (!$is_platform) { + $request['extend'] = I('request.extend'); + $extend_data = M('spend','tab_')->where(array('extend'=>$request['extend'],'game_id'=>$request['game_id']))->find(); + if($extend_data){ + redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'is_platform'=> $is_platform,'msg'=>$request['game_id'].'订单号重复,请关闭支付页面重新支付'.$request['extend'], 'user_token' => $userToken)));exit; + } + } + + //折扣 + $user = get_user_entity($request['user_id']); + $discount = $this->get_discount($request['game_id'],$user['promote_id'],$request['user_id']); + $discount = $discount['discount']; + $pay_amount = $discount * $request['price'] / 10; + if ($pay_amount < 0.01) { + redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'is_platform'=> $is_platform, 'msg'=>'充值金额有误.'.$pay_amount, 'user_token' => $userToken)));exit; + } + + if (!$is_platform) { + $this->other_price($request, $request['price']-$pay_amount); + } + // 平台币充值 if ($is_platform) { $request['code'] = 0; @@ -741,29 +868,16 @@ class ShortcutController extends BaseController{ $this->assign("order_id", $request['pay_order_number']); $this->assign('goods_info',$request['goods_info']); - if (I('step')) { - $bank_info = $this->checkBankCard(); - - $this->assign('bank_info',$bank_info); - $this->assign('cardNo',I('card_no')); + $bank_info = $this->checkBankCard(); - $this->display('yee_step2'); - } else { - - $this->display(); + $this->assign('bank_info',$bank_info); + $this->assign('cardNo',I('card_no')); - } + $this->display(); } -// public function yee_step2() { -// -// -// -// $this->display(); -// } - //返回银行卡信息 public function checkBankCard() { diff --git a/Application/Sdk/View/default/Shortcut/yee_step1.html b/Application/Sdk/View/default/Shortcut/yee_step1.html index 731460de..2b910a83 100644 --- a/Application/Sdk/View/default/Shortcut/yee_step1.html +++ b/Application/Sdk/View/default/Shortcut/yee_step1.html @@ -17,7 +17,7 @@ 银行卡快捷支付 -