diff --git a/Application/Sdk/Controller/ExchangeController.class.php b/Application/Sdk/Controller/ExchangeController.class.php index f2793e0f..815f7ce1 100644 --- a/Application/Sdk/Controller/ExchangeController.class.php +++ b/Application/Sdk/Controller/ExchangeController.class.php @@ -185,9 +185,15 @@ class ExchangeController extends BaseController{ $this->set_message(1089,"fail","订单号重复,请关闭支付页面重新支付"); } -// file_put_contents("./Application/Sdk/Scheme/".$request['game_id'].".txt",$request['scheme']); + // -----------apple beta版 测试账号走第三方支付 + $testUser = ['test11', 'test12', 'test13', 'test142', + 'test171','test830','test1003','test1002','test170','test169']; + $istest = false; + if (in_array($userPlayInfo['user_account'], $testUser)) { + $istest = true; + } - if(get_game_appstatus2($request['game_id'])/* &&$request['is_create_ordernumer']!=1 */){ /* 第三方支付 */ + if(get_game_appstatus2($request['game_id'] || $istest)/* &&$request['is_create_ordernumer']!=1 */){ /* 第三方支付 */ $prefix = $request['code'] == 1 ? "SP_" : "PF_"; // SP $out_trade_no = $prefix.date('Ymd').date('His').sp_random_string(4); $request['pay_order_number'] = $out_trade_no; diff --git a/Application/Sdk/Controller/PayH5Controller.class.php b/Application/Sdk/Controller/PayH5Controller.class.php index 6dfa05cc..7f3df8ed 100644 --- a/Application/Sdk/Controller/PayH5Controller.class.php +++ b/Application/Sdk/Controller/PayH5Controller.class.php @@ -23,35 +23,31 @@ class PayH5Controller extends BaseController{ if (!$this->userId) { $this->error("用户未登入"); } - $request['user_id'] = $this->userId; + $user_id = $this->userId; $game_id = I('request.game_id'); // 支付验证 是否让支付 $payCheck = pay_check($this->userId); if (!$payCheck['code']) { redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>$payCheck['msg'], 'user_token' => $this->userToken)));exit; - -// echo json_encode(['code'=>0,'msg'=> $payCheck['msg']]);exit; } - $pay_order_number = I('request.pay_order_number', 0); - if ($pay_order_number) { - $payOrder = M("deposit", "tab_")->where(['pay_order_number' => $pay_order_number])->find(); - if ($payOrder['pay_status'] == 1) { - $this->success("充值成功", "/sdk.php/"); - } - $pay_order_number = $payOrder['pay_amount']; - $request['pay_order_number'] = $pay_order_number; - $price = $payOrder['pay_amount']; - } else { - $price = I('request.price'); - $request['price'] = $price; - $request['pay_order_number'] = 'PF_'.date('Ymd').date('His').sp_random_string(4); + $request['user_id'] = $user_id; + $request['price'] = I('request.price'); + $pay_info = M('pay_info', 'tab_')->where([ + 'user_id' => $user_id, + 'game_id' => $game_id, + 'type' => 'platform_pay', + ])->order('id desc')->find(); + if ($pay_info['price'] != $request['price']) { + jsonOutput(0, "充值金额有误.."); } + $price = $request['price']; $price = round($price, 2); if($price <= 0){ redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>'充值金额有误', 'user_token' => $this->userToken)));exit; } + $request['pay_order_number'] = $pay_info['order_id']; if(get_zfb_type()==0){ // 支付宝官方 if(C('alipay.way')==1/* || ($request['is_create_ordernumer']==1 && C('alipay.way')==0) */){ /* wap */ @@ -522,6 +518,8 @@ class PayH5Controller extends BaseController{ $table = $param['code'] == 1 ? "spend" : "deposit"; $prefix = $param['code'] == 1 ? "SP_" : "PF_"; $out_trade_no = $prefix.date('Ymd').date('His').sp_random_string(4); + if ($param['pay_order_number']) $out_trade_no = $param['pay_order_number']; + $user = get_user_entity($param['user_id']); switch ($param['apitype']) { case 'swiftpass': @@ -601,12 +599,21 @@ ADD COLUMN `pay_url` text NULL AFTER `check_sign`; //redirect(U('Spend/notice',array('user_id'=>$user_id, 'is_platform' => 1, 'msg'=>'充值金额有误', 'game_id' => $game_id, 'user_token' => $this->userToken)));exit; } + $pay_info = M('pay_info', 'tab_')->where([ + 'user_id' => $user_id, + 'game_id' => $game_id, + 'type' => 'platform_pay', + ])->order('id desc')->find(); + if ($pay_info['price'] != $request['price']) { + jsonOutput(0, "充值金额有误.."); + } + $pay_amount = $request['price']; $prefix = "PF_"; $request['pay_way'] = C("PAY_WAY.WEIXIN"); $request['pay_status'] = 0; $request['spend_ip'] = get_client_ip(); - $request['pay_order_number'] = 'PF_'.date('Ymd').date('His').sp_random_string(4); + $request['pay_order_number'] = $pay_info['order_id']; //'PF_'.date('Ymd').date('His').sp_random_string(4); $request['sdk_version'] = I('request.sdk_version'); //0 官方 1威富通 2俊付通 diff --git a/Application/Sdk/View/default/Spend/pay_way.html b/Application/Sdk/View/default/Spend/pay_way.html index cf10a90a..f46d4009 100644 --- a/Application/Sdk/View/default/Spend/pay_way.html +++ b/Application/Sdk/View/default/Spend/pay_way.html @@ -213,14 +213,13 @@ - +
其他支付方式
- 确认支付