From 8866c33f575cf8a0207729f9c851e15c7ce923f3 Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Tue, 17 Mar 2020 14:04:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=8C=E4=B9=BE=E6=94=AF=E4=BB=98bug?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/ShortcutController.class.php | 36 +++++++++++++++---- .../Sdk/View/default/Spend/pay_way.html | 28 ++++++++++++++- 2 files changed, 57 insertions(+), 7 deletions(-) diff --git a/Application/Sdk/Controller/ShortcutController.class.php b/Application/Sdk/Controller/ShortcutController.class.php index 545d8392..0ef6b71f 100644 --- a/Application/Sdk/Controller/ShortcutController.class.php +++ b/Application/Sdk/Controller/ShortcutController.class.php @@ -623,6 +623,10 @@ class ShortcutController extends BaseController{ $user_id = $request['user_id']; $request['code'] = I('request.code'); + if (!$user_id) { + echo json_encode(['code'=>0,'msg'=>'用户id为空,请退出支付界面重新进入']);exit; + } + $payInfo = M('pay_info', 'tab_')->where([ 'user_id' => I('user_id'), 'game_id' => I('game_id'), @@ -634,20 +638,28 @@ class ShortcutController extends BaseController{ $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; +// redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'is_platform'=> $is_platform,'msg'=>'登录数据不能为空', 'user_token' => $userToken))); + echo json_encode(['code'=>0,'msg'=>'登录数据不能为空']); + 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; +// redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'is_platform'=> $is_platform,'msg'=>$payCheck['msg'], 'user_token' => $userToken))); + echo json_encode(['code'=>0,'msg'=>$payCheck['msg']]); + 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; +// redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'is_platform'=> $is_platform,'msg'=>'该游戏暂时无法充值,请联系客服!', 'user_token' => $userToken))); + echo json_encode(['code'=>0,'msg'=>'该游戏暂时无法充值,请联系客服!']); + 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; +// redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'is_platform'=> $is_platform,'msg'=>'充值金额有误', 'user_token' => $userToken))); + echo json_encode(['code'=>0,'msg'=>'充值金额有误']); + exit; } C(api('Config/lists')); @@ -656,7 +668,9 @@ class ShortcutController extends BaseController{ $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; +// 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))); + echo json_encode(['code'=>0,'msg'=>$request['game_id'].'订单号重复,请关闭支付页面重新支付'.$request['extend']]); + exit; } } @@ -666,7 +680,9 @@ class ShortcutController extends BaseController{ $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; +// redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'is_platform'=> $is_platform, 'msg'=>'充值金额有误.'.$pay_amount, 'user_token' => $userToken))); + echo json_encode(['code'=>0,'msg'=>'充值金额有误.'.$pay_amount]); + exit; } if (!$is_platform) { @@ -723,6 +739,13 @@ class ShortcutController extends BaseController{ } } + if ($_REQUEST['sign']) { + + echo json_encode(['code'=>200,'msg'=>'success']); + exit; + + } + //0 官方 1双乾 if (get_shortcut_pay_type() == 0) { // 暂时只有双乾 @@ -734,6 +757,7 @@ class ShortcutController extends BaseController{ } } + $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']); diff --git a/Application/Sdk/View/default/Spend/pay_way.html b/Application/Sdk/View/default/Spend/pay_way.html index a1237542..fc595ac5 100644 --- a/Application/Sdk/View/default/Spend/pay_way.html +++ b/Application/Sdk/View/default/Spend/pay_way.html @@ -404,7 +404,33 @@ //sq快捷支付 function sqshorcut(){ - window.location.href = payurl; + + var url = payurl; + + $.ajax({ + type:'post', + dataType:'json', + data:{sign: 1}, + url:url, + success:function(result) { + if(result.code==200) { + window.location.href = payurl; + } else { + flag=false; + $(".tipmsg").html(result.msg); + $(".msgdialog").show(); + } + }, + error:function(){ + flag=false; + $(".tipmsg").html("接口请求错误"); + $(".msgdialog").show(); + } + }); + return false; + + + // window.location.href = payurl; } //平台币支付 function platform_pay(){