From d8a732f6e341d1af94f1c13946124702604a14e8 Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Mon, 16 Mar 2020 18:35:43 +0800 Subject: [PATCH] =?UTF-8?q?ip=E9=99=90=E5=88=B6=E7=99=BD=E5=90=8D=E5=8D=95?= =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Sdk/Common/function.php | 25 +++++++++++++ .../Controller/ExchangeController.class.php | 37 ++++++++++++++++++- .../Sdk/Controller/GameController.class.php | 36 +++++++++++------- 3 files changed, 83 insertions(+), 15 deletions(-) diff --git a/Application/Sdk/Common/function.php b/Application/Sdk/Common/function.php index 176bb4ef..b8a89ff7 100644 --- a/Application/Sdk/Common/function.php +++ b/Application/Sdk/Common/function.php @@ -360,3 +360,28 @@ function log_action($log) { $log['create_time'] = time(); M('user_action_log', 'tab_')->data($log)->add(); } + +/** + * 是否开启苹果内购通知 + * @return bool + */ +function getAppleInteriorBuyStatus() { + + $appleInteriorBuyStatus = M('tool','tab_')->where(['name'=>'apple_interior_buy'])->getField('status'); + + return $appleInteriorBuyStatus?true:false; + +} + +/** + * 记录行为日志 + * @param $user_id + * @return bool + */ +function getIpForbitWhiteList($user_id) { + + $is_white_list = M('forbit_ip', 'tab_')->where(['user_id'=>$user_id,'status'=>1])->find(); + + return $is_white_list?true:false; + +} \ No newline at end of file diff --git a/Application/Sdk/Controller/ExchangeController.class.php b/Application/Sdk/Controller/ExchangeController.class.php index 17003b60..f0f0b769 100644 --- a/Application/Sdk/Controller/ExchangeController.class.php +++ b/Application/Sdk/Controller/ExchangeController.class.php @@ -725,7 +725,7 @@ class ExchangeController extends BaseController{ $map['pay_order_number'] = $out_trade_no; - $payamountVerify=M('spend','tab_')->field('id,pay_order_number,extend,pay_amount')->where($map)->find(); + $payamountVerify=M('spend','tab_')->field('id,pay_order_number,extend,pay_amount,user_id')->where($map)->find(); if($payamountVerify['pay_amount']!=$request['price']){ @@ -763,9 +763,42 @@ class ExchangeController extends BaseController{ $param['out_trade_no'] = $out_trade_no; + $isBeta = false; + $isUSBeta = false; + if (isset($request['app_type']) && $request['app_type'] == 2) { + $isBeta = true; + // 美国IP 贝塔版 + $ip = get_client_ip(); + // todo: 暂时取消美国IP 后面做白名单 + $isUSBeta = ip_is_country($ip); +// $isUSBeta = false; + } + $game = new GameApi(); - $game->game_pay_notify($param); + //判断是否开启苹果内购支付通知 + $appleInteriorBuyStatus = M('tool','tab_')->where(['name'=>'apple_interior_buy'])->getField('status'); + + if (!$appleInteriorBuyStatus) { + + if ($isBeta && $isUSBeta) { + + $is_white_list = M('forbit_ip', 'tab_')->where(['user_id'=>$payamountVerify['user_id'],'status'=>1])->find(); + + if ($is_white_list) { + $game->game_pay_notify($param); + } + + } else { + $game->game_pay_notify($param); + } + + } else { + + $game->game_pay_notify($param); + + } + break; diff --git a/Application/Sdk/Controller/GameController.class.php b/Application/Sdk/Controller/GameController.class.php index 67c47c31..970d9e5a 100644 --- a/Application/Sdk/Controller/GameController.class.php +++ b/Application/Sdk/Controller/GameController.class.php @@ -156,8 +156,8 @@ class GameController extends BaseController{ // 美国IP 贝塔版 $ip = get_client_ip(); -// $isUSIP = ip_is_country($ip); - $isUSIP = false; + $isUSIP = ip_is_country($ip); +// $isUSIP = false; // var_dump($isUSIP); if(empty($data['user_id'])) { re_msg(1004, 'fail', '用户不存在'); @@ -200,11 +200,16 @@ class GameController extends BaseController{ } } // var_dump($isUSIP); - if (/* isset($data['app_type']) && $data['app_type'] == 2 && */$isUSIP) { - - if($v['name'] == 'gift' || $v['name'] == 'suppersign') { - unset($menus[$k]); - continue; + //判断是否开启苹果内购,beta包,美国ip,且是否在白名单当中 + if (!getAppleInteriorBuyStatus()) { + if (isset($data['app_type']) && $data['app_type'] == 2 && $isUSIP) { + + if (!getIpForbitWhiteList($data['user_id'])) { + if ($v['name'] == 'gift' || $v['name'] == 'suppersign') { + unset($menus[$k]); + continue; + } + } } } @@ -267,14 +272,19 @@ class GameController extends BaseController{ continue; } } - - if (/* isset($data['app_type']) && $data['app_type'] == 2 && */$isUSIP) { - if($v['name'] == 'gift' || $v['name'] == 'balance') { - unset($personalMenu[$k]); - continue; + + if (!getAppleInteriorBuyStatus()) { + if (isset($data['app_type']) && $data['app_type'] == 2 && $isUSIP) { + + if (!getIpForbitWhiteList($data['user_id'])) { + if ($v['name'] == 'gift' || $v['name'] == 'balance') { + unset($personalMenu[$k]); + continue; + } + } } } - + //测试账号苹果审核 $personalMenu[$k]['icon'] = (substr($v['icon'], 0, 7) == "http://" || substr($v['icon'], 0, 8) == "https://" ) ? $v['icon'] : C('ADMIN_DOMAIN') . $v['icon'];