From d2a6dfcc9823843ab542e98d634e4083ae47f94b Mon Sep 17 00:00:00 2001 From: tpingzhang <635929049@qq.com> Date: Wed, 11 Dec 2019 10:45:07 +0800 Subject: [PATCH] =?UTF-8?q?=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/AppleController.class.php | 14 ++++++++++---- .../Sdk/Controller/BaseController.class.php | 11 +++++++---- .../Sdk/Controller/ExchangeController.class.php | 4 ++-- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/Application/Sdk/Controller/AppleController.class.php b/Application/Sdk/Controller/AppleController.class.php index 7b983342..5af49b04 100644 --- a/Application/Sdk/Controller/AppleController.class.php +++ b/Application/Sdk/Controller/AppleController.class.php @@ -90,7 +90,7 @@ class AppleController extends BaseController{ public function apple_alipay_pay($user_id,$game_id){ #获取SDK上POST方式传过来的数据 然后base64解密 然后将json字符串转化成数组 //echo json_encode(['code'=>0,'msg'=> $user_id."game:".$game_id]);exit; - $request = $this->get_sdk_request($game_id); + $request = $this->get_sdk_request($game_id, $user_id); $request['pay_order_number'] = "SP_".date('Ymd').date('His').sp_random_string(4); $request['pay_status'] = 0; $request['pay_way'] = C("PAY_WAY.ALIPAY"); @@ -360,7 +360,7 @@ class AppleController extends BaseController{ */ public function apple_weixin_pay($user_id,$game_id) { - $request = $this->get_sdk_request($game_id); + $request = $this->get_sdk_request($game_id, $user_id); $request['pay_order_number'] = "SP_".date('Ymd').date('His').sp_random_string(4); $request['pay_status'] = 0; $request['pay_way'] = C("PAY_WAY.WEIXIN"); @@ -644,9 +644,15 @@ class AppleController extends BaseController{ * @author 鹿文学 */ public function apple_platform_pay($user_id,$game_id) { - $file=file_get_contents("./Application/Sdk/OrderNo/".$user_id."-".$game_id.".txt"); - $request = json_decode(think_decrypt($file),true); + /* $file=file_get_contents("./Application/Sdk/OrderNo/".$user_id."-".$game_id.".txt"); + $request = json_decode(think_decrypt($file),true); */ + $request = $this->get_sdk_request($game_id, $user_id); + $request['pay_order_number'] = "SP_".date('Ymd').date('His').sp_random_string(4); + $request['pay_status'] = 0; +// $request['pay_way'] = C("PAY_WAY.ALIPAY"); + $request['spend_ip'] = get_client_ip(); + $code = $_POST['way']; if (empty($request)) { diff --git a/Application/Sdk/Controller/BaseController.class.php b/Application/Sdk/Controller/BaseController.class.php index 8c5597f9..82a3a107 100644 --- a/Application/Sdk/Controller/BaseController.class.php +++ b/Application/Sdk/Controller/BaseController.class.php @@ -874,12 +874,15 @@ class BaseController extends RestController{ /** * 获取cp传过来的订单号等信息在exchange接口 */ - public function get_sdk_request($game_id) { - if (!$this->userId) { - return ; + public function get_sdk_request($game_id, $user_id=0) { + if (!$user_id) { + if (!$this->userId) { + return ; + } + $user_id = $this->userId; } $payInfo = M("pay_info", "tab_")->where([ - 'user_id' => $this->userId, + 'user_id' => $user_id, 'game_id' => $game_id ])->order('id desc')->find(); if (!$payInfo || !$payInfo['info']) { diff --git a/Application/Sdk/Controller/ExchangeController.class.php b/Application/Sdk/Controller/ExchangeController.class.php index 9d8102dc..d277e3bb 100644 --- a/Application/Sdk/Controller/ExchangeController.class.php +++ b/Application/Sdk/Controller/ExchangeController.class.php @@ -155,7 +155,7 @@ class ExchangeController extends BaseController{ if($request['code'] == 0) { /* 平台币充值 */ - file_put_contents("./Application/Sdk/Scheme/".$request['game_id'].".txt",$request['scheme']); +// file_put_contents("./Application/Sdk/Scheme/".$request['game_id'].".txt",$request['scheme']); $prefix = "PF_"; @@ -168,7 +168,7 @@ class ExchangeController extends BaseController{ $request['spend_ip'] = get_client_ip(); // $url = C('PAY_DOMAIN') . '/sdk.php?s=/Spend/'.$payPage.'&user_id='.$request['user_id'].'&game_id='.$request['game_id'].'&type=1'.'&user_token='.$userToken.'&action=pay'; - file_put_contents("./Application/Sdk/OrderNo/".$request['user_id']."-".$request['game_id'].".txt",think_encrypt(json_encode($request))); +// file_put_contents("./Application/Sdk/OrderNo/".$request['user_id']."-".$request['game_id'].".txt",think_encrypt(json_encode($request))); // $url = C('PAY_DOMAIN') . '/sdk.php?s=/userH/platform_pay/account/'.$request['account'].'&user_token='.$userToken.'&game_id='.$request['game_id'].'&money='.$request['price'].'&action=pay1&api_ver=1'; // echo base64_encode(json_encode(array('status'=>200,'out_trade_no'=>$out_trade_no,'img'=>$url))); echo base64_encode(json_encode(array('status'=>200,'out_trade_no'=>$out_trade_no,'img'=>C('PAY_DOMAIN').'/sdk.php?s=/Spend/pay_way_v1&user_id='.$request['user_id'].'&game_id='.$request['game_id'].'&type=1'.'&user_token='.$userToken)));exit;