diff --git a/Application/Callback/Controller/BaseController.class.php b/Application/Callback/Controller/BaseController.class.php index bb99fd92..264d4f06 100644 --- a/Application/Callback/Controller/BaseController.class.php +++ b/Application/Callback/Controller/BaseController.class.php @@ -178,6 +178,11 @@ class BaseController extends Controller { $data_save['payed_time'] = time(); $map_s['pay_order_number'] = $data['out_trade_no']; $r = $spend->where($map_s)->save($data_save); + // spend 记录传给通知cp 不直接读 + $pay_data = $d; + $pay_data['pay_status'] = $data_save['pay_status']; + $pay_data['order_number'] = $data_save['order_number']; + $pay_data['payed_time'] = $data_save['payed_time']; // 更新意向表支付成功记录 $payChannelIntention = new PayChannelIntentionModel(); $payChannelIntention->updatePaySuccess($data['out_trade_no']); @@ -205,7 +210,7 @@ class BaseController extends Controller { } $game = new GameApi(); - $r = $game->game_pay_notify($data,1); + $r = $game->game_pay_notify($data, 1, 0, $pay_data); if ($r == 'success') { // 更新意向表游戏通知成功记录 $payChannelIntention->updateGameNotifySuccess($data['out_trade_no']); diff --git a/Application/Common/Api/GameApi.class.php b/Application/Common/Api/GameApi.class.php index 796b401a..f8a4e249 100644 --- a/Application/Common/Api/GameApi.class.php +++ b/Application/Common/Api/GameApi.class.php @@ -18,11 +18,11 @@ class GameApi { } - public function game_pay_notify($param=null,$code=1,$is_uc=0, $isIosTest=0){ + public function game_pay_notify($param=null,$code=1,$is_uc=0, /* $isIosTest=0, */ $pay_data=0){ Log::write("notice:".serialize($param), Log::DEBUG); - if (!$isIosTest) { // 苹果内购 不判断订单支付成功 正常通知CP + /* if (!$isIosTest) { // 苹果内购 不判断订单支付成功 正常通知CP $pay_map['pay_status'] = 1; - } + } */ $pay_map['pay_game_status'] = 0; if($is_uc){ $uc=new Ucservice(); @@ -30,7 +30,9 @@ class GameApi { $pay_data=$uc->uc_spend_find($pay_map['pay_order_number']); }else{ $pay_map['pay_order_number'] = $param['out_trade_no']; - $pay_data = M("Spend","tab_")->where($pay_map)->find(); + if (!$pay_data) { + $pay_data = M("Spend","tab_")->where($pay_map)->find(); + } } if(empty($pay_data)){ diff --git a/Application/Sdk/Controller/ExchangeController.class.php b/Application/Sdk/Controller/ExchangeController.class.php index 27beda0a..9b10ef0f 100644 --- a/Application/Sdk/Controller/ExchangeController.class.php +++ b/Application/Sdk/Controller/ExchangeController.class.php @@ -205,6 +205,11 @@ class ExchangeController extends BaseController{ // 是否是beta版苹果内购 $isBeta = false; $isUSBeta = false; + // 白名单用户一定走第三方支付 + $isWhite = M('ip_forbit', 'tab_')->where([ + 'user_id' => $userId, + 'type' => 1 + ])->find(); if (isset($request['app_type']) && $request['app_type'] == 2) { $isBeta = true; // 美国IP 贝塔版 @@ -212,19 +217,17 @@ class ExchangeController extends BaseController{ // todo: 暂时取消美国IP 后面做白名单 $isUSBeta = ip_is_country($ip); } - // 美国IP的贝塔包 不管游戏设置怎么设置 都走苹果支付 - if (!$isUSBeta && (get_game_appstatus2($request['game_id']) || $istest || !$isBeta/* &&$request['is_create_ordernumer']!=1 */)){ /* 第三方支付 */ + // 美国IP的贝塔包 不管游戏设置怎么设置 都走苹果支付 白名单内的用户一定走第三方支付 + if ($isWhite || (!$isUSBeta && (/* get_game_appstatus2($request['game_id']) || */ $istest || !$isBeta ))){ /* 第三方支付 */ $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; $request['pay_status'] = 0; $request['spend_ip'] = get_client_ip(); -// pp($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=/Spend/'.$payPage.'&user_id='.$request['user_id'].'&game_id='.$request['game_id'].'&type=1'.'&user_token='.$userToken.'&action=pay'.'&extend='.urlencode($request['extend']); echo base64_encode(json_encode(array('status'=>200,'out_trade_no'=>$out_trade_no,'img'=>$url)));exit; - // 只走第三方支付 不走苹果支付 - } elseif ($isUSBeta || (!get_game_appstatus2($request['game_id'] && $isBeta))/* &&$request['is_create_ordernumer']==1 */){ /* 废弃 苹果支付 */ + // 只走第三方支付 不走苹果支付 美国ip TF包走苹果内购 + } elseif ($isUSBeta /* || (!get_game_appstatus2($request['game_id'] && $isBeta) )*/){ /* 废弃 苹果支付 */ #获取订单信息 $prefix = $request['code'] == 1 ? "SP_" : "PF_"; @@ -732,7 +735,7 @@ class ExchangeController extends BaseController{ $map['pay_order_number'] = $out_trade_no; - $payamountVerify=M('spend','tab_')->field('id,pay_order_number,extend,pay_amount,user_id')->where($map)->find(); + $payamountVerify=M('spend','tab_')->field('*')->where($map)->find(); if($payamountVerify['pay_amount']!=$request['price']){ @@ -796,10 +799,14 @@ class ExchangeController extends BaseController{ //判断是否开启苹果内购支付通知 if ($isBeta /* && $isUSBeta */) { - $is_white_list = M('forbit_ip', 'tab_')->where(['user_id'=>$payamountVerify['user_id'],'status'=>1])->find(); + $is_white_list = M('forbit_ip', 'tab_')->where([ + 'user_id'=>$payamountVerify['user_id'], + 'status'=>1, + 'type' => 0 + ])->find(); if ($is_white_list) { - $game->game_pay_notify($param, 1, 0, 1); + $game->game_pay_notify($param, 1, 0, $payamountVerify); } } else {