From b418c2ed53542fbe538afc8883c21cb6bd36f5e2 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 5 Nov 2019 14:33:16 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=85=85=E5=80=BC=E6=9C=AA=E4=BC=98?= =?UTF-8?q?=E5=85=88=E4=BD=BF=E7=94=A8=E5=B9=B3=E5=8F=B0=E5=B8=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sdk/Controller/SpendController.class.php | 13 +++++++------ Application/Sdk/View/default/Spend/pay_way.html | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Application/Sdk/Controller/SpendController.class.php b/Application/Sdk/Controller/SpendController.class.php index 5401122b..3d3f91e0 100644 --- a/Application/Sdk/Controller/SpendController.class.php +++ b/Application/Sdk/Controller/SpendController.class.php @@ -52,16 +52,15 @@ class SpendController extends Controller { die(); } $userId = M('user', 'tab_')->where(['user_token'=>$user_token])->getField('id'); - if ($userId != $user_id) { - echo "请重新登入!"; - die(); - } + // if ($userId != $user_id) { + // echo "请重新登入!"; + // die(); + // } C(BaseController::get_tool()); // pp(BaseController::get_tool()); $file = file_get_contents ( "./Application/Sdk/OrderNo/" . $user_id . "-" . $game_id . ".txt" ); $request = json_decode ( think_decrypt ( $file ), true ); - $data = array( 'coin' => $request ['body'], 'price' => $request ['price'], @@ -76,14 +75,15 @@ class SpendController extends Controller { 'game_id' => $game_id ) )->getField ( 'bind_balance' ); // $data['price'] = 1; - $this->assign ( 'balance', $balance ); $this->assign ( 'bind_balance', $bind_balance ); $this->assign ( 'data', $data ); $this->assign ( 'btncolor', $request ['btncolor'] ); if ($balance + $bind_balance > $data['price']) { + $apply_money = $data['price']; $this->assign ('pay_price', 0); // 是否第三方支付 } else { + $apply_money = $balance + $bind_balance; $payPrice = $data['price'] - $balance - $bind_balance; $this->assign ('pay_price', $payPrice ? $payPrice : 0); } @@ -98,6 +98,7 @@ class SpendController extends Controller { unset($data['pay_way']); /* if ($request['sdk_version'] == 1) // android 没有 is_create_ordernumer苹果内购 unset($data['is_create_ordernumer']); */ + $this->assign('apply_money',$apply_money); //适用平台金额 $this->assign('sdk_version', $request['sdk_version']); $this->assign('small_json', json_encode(array( 'appId' => 'wx8419130aa4ff123b', diff --git a/Application/Sdk/View/default/Spend/pay_way.html b/Application/Sdk/View/default/Spend/pay_way.html index 6060fc46..9db94d42 100644 --- a/Application/Sdk/View/default/Spend/pay_way.html +++ b/Application/Sdk/View/default/Spend/pay_way.html @@ -154,7 +154,7 @@

适用平台余额:

-
-¥{$balance+$bind_balance}
+
-¥{$apply_money}
From cd8c3f4d287cba65e13ebcdd3c1bfef8ff7480f0 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 5 Nov 2019 14:58:06 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=85=85=E5=80=BC=E6=9C=AA=E4=BC=98?= =?UTF-8?q?=E5=85=88=E4=BD=BF=E7=94=A8=E5=B9=B3=E5=8F=B0=E5=B8=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Sdk/Controller/SpendController.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Application/Sdk/Controller/SpendController.class.php b/Application/Sdk/Controller/SpendController.class.php index 3d3f91e0..9a1da4a9 100644 --- a/Application/Sdk/Controller/SpendController.class.php +++ b/Application/Sdk/Controller/SpendController.class.php @@ -52,10 +52,10 @@ class SpendController extends Controller { die(); } $userId = M('user', 'tab_')->where(['user_token'=>$user_token])->getField('id'); - // if ($userId != $user_id) { - // echo "请重新登入!"; - // die(); - // } + if ($userId != $user_id) { + echo "请重新登入!"; + die(); + } C(BaseController::get_tool()); // pp(BaseController::get_tool()); From 6d2ff7a95dd474aded61334ab0e6645ef9a76f1b Mon Sep 17 00:00:00 2001 From: tpingzhang <635929049@qq.com> Date: Tue, 5 Nov 2019 16:17:02 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E6=94=AF=E4=BB=98=20?= =?UTF-8?q?=E4=BC=98=E5=85=88=E6=89=A3=E9=99=A4=E7=BB=91=E5=AE=9A=E5=B8=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sdk/Controller/PayH5Controller.class.php | 8 ++++++-- Application/Sdk/View/default/Spend/pay_way.html | 16 +++++++++++++++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Application/Sdk/Controller/PayH5Controller.class.php b/Application/Sdk/Controller/PayH5Controller.class.php index dee07c74..d018b40a 100644 --- a/Application/Sdk/Controller/PayH5Controller.class.php +++ b/Application/Sdk/Controller/PayH5Controller.class.php @@ -1195,6 +1195,7 @@ ADD COLUMN `pay_url` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL AFTER // file_put_contents(dirname(__FILE__).'/1222222.txt',get_wx_pay_type()); // 绑币平台币优先处理 $this->other_price($request, $discountAmount); + $pay_amount = $request['price']; //0 官方 1威富通 2俊付通 if (get_wx_pay_type() == 0) { @@ -1333,13 +1334,16 @@ ADD COLUMN `pay_url` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL AFTER $json_data['url']='http://'.$_SERVER ['HTTP_HOST']; } } - redirect(U('spend/paycallback', array( + + echo json_encode(['code' => 200, 'url' => U('spend/paycallback', array( 'sdk_version' => $request['sdk_version'], 'paytype' => 'weixinpay', 'orderno' => $request['pay_order_number'], 'game_id' => $game_id, 'gopay' => 1 // 立即支付 - ))); + ))]); + exit; + // redirect($json_data['url']); } diff --git a/Application/Sdk/View/default/Spend/pay_way.html b/Application/Sdk/View/default/Spend/pay_way.html index 9db94d42..d7e381f2 100644 --- a/Application/Sdk/View/default/Spend/pay_way.html +++ b/Application/Sdk/View/default/Spend/pay_way.html @@ -251,7 +251,21 @@ $(function() { flag = true; $r = small_program("{:C('sqpay.wx_small')}"); if ($r) { - window.location.href = $(this).data('url'); + var url = $(this).data('url'); + + $.ajax({ + type:'post', + dataType:'json', + data:{}, + url:url, + success:function(result) { + if(result.code==200) { + window.location.href = result.url; + } + } + }); + + //window.location.href = $(this).data('url'); } }); From 407176d5431d8d59dad8af1ff71a4625b0b5e2a6 Mon Sep 17 00:00:00 2001 From: tpingzhang <635929049@qq.com> Date: Tue, 5 Nov 2019 16:23:47 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=BF=AB=E6=8D=B7=E6=94=AF=E4=BB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Sdk/Controller/WapPayController.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Application/Sdk/Controller/WapPayController.class.php b/Application/Sdk/Controller/WapPayController.class.php index a52e5f5e..3486f6ca 100644 --- a/Application/Sdk/Controller/WapPayController.class.php +++ b/Application/Sdk/Controller/WapPayController.class.php @@ -227,7 +227,8 @@ class WapPayController extends BaseController{ */ public function shortcut_pay() { $sqpay = new Sqpay(); - $param = I(); + $param = I("request."); + $signContract = false; // 签约标记 if (!$param['user_id'] || !$param['game_id']) { @@ -268,7 +269,7 @@ class WapPayController extends BaseController{ 'secret' => C('sqpay.key'), )); //echo "发起支付==》".time()."
"; - sleep(5); +// sleep(5); if ($rsp['responseCode'] == '88') { redirect(U('Spend/pay_success',array('orderno' => $payInfo['order_id'], 'user_id'=>$param['user_id'],'game_id'=>$param['game_id'])));exit; } else {