From 6ece7deeee7cb66f2625fef45bede408cc244ba4 Mon Sep 17 00:00:00 2001 From: tping Date: Tue, 24 Dec 2019 16:48:53 +0800 Subject: [PATCH] =?UTF-8?q?1=EF=BC=8C=E8=BA=AB=E4=BB=BD=E8=AF=81=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=202=EF=BC=8C=E9=85=8D=E5=90=88=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E5=88=86=E6=88=90=E6=AF=94=E4=BE=8B=203=EF=BC=8C=E8=8B=B9?= =?UTF-8?q?=E6=9E=9C=E5=86=85=E8=B4=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Common/Common/extend.php | 53 +++++++++++++++++++ .../Sdk/Controller/BaseController.class.php | 2 +- .../Controller/ExchangeController.class.php | 12 +++-- .../Sdk/Controller/UserController.class.php | 2 +- ThinkPHP/Library/Think/Pay.class.php | 2 +- 5 files changed, 64 insertions(+), 7 deletions(-) diff --git a/Application/Common/Common/extend.php b/Application/Common/Common/extend.php index 7b290c3d..17d6ead0 100644 --- a/Application/Common/Common/extend.php +++ b/Application/Common/Common/extend.php @@ -1053,6 +1053,59 @@ function is_check_account($account){ if(empty($data)){return '';} return $data['ratio']; } + + //获取游戏cp比例 + function getGameSelleRatio($promoteId = null, $gameId = null, $field = 'id') + { + $promoteGameRatio = getGameSelleRatioByPromote($promoteId, $gameId); + if ($promoteGameRatio === false) { + $map[$field] = $gameId; + $data = M('game', 'tab_')->where($map)->find(); + if (empty($data)) { + return 0; + } + return $data['ratio']; + } else { + return $promoteGameRatio; + } + } + + //获取推广员设置的游戏cp比例 + function getGameSelleRatioByPromote($promoteId = null, $gameId = null) + { + if (empty($promoteId) || empty($gameId)) { + return false; + } + + $promoteId = intval($promoteId); + $gameId = intval($gameId); + $promote = M('promote', 'tab_')->find($promoteId); + + if (empty($promote)) { + return false; + } + if ($promote['level'] != 1) { + $chain = explode('/', trim($promote['chain'], '/')); + $promoteId = empty($chain[0]) ? 0 : intval($chain[0]); + } + + $map['promote_id'] = $promoteId; + $map['game_id'] = $gameId; + $promoteGameRatio = M('promote_game_ratio', 'tab_')->where($map)->find(); + + if (empty($promoteGameRatio) || $promoteGameRatio['status'] != 1) { + return false; + } + if ($promoteGameRatio['begin_time'] > time()) { + return false; + } + if (!empty($promoteGameRatio['end_time']) && $promoteGameRatio['end_time'] < time()) { + return false; + } + + return $promoteGameRatio['ratio']; + } + /** * [获取管理员昵称] diff --git a/Application/Sdk/Controller/BaseController.class.php b/Application/Sdk/Controller/BaseController.class.php index 67a4d07d..4ce521fd 100644 --- a/Application/Sdk/Controller/BaseController.class.php +++ b/Application/Sdk/Controller/BaseController.class.php @@ -508,7 +508,7 @@ class BaseController extends RestController{ $data_spned['game_id'] = $param["game_id"]; $data_spned['game_appid'] = $param["game_appid"]; $data_spned['game_name'] = get_game_name($param["game_id"]); - $data_spned['selle_ratio'] = get_game_selle_ratio($param["game_id"]); + $data_spned['selle_ratio'] = getGameSelleRatio($user_entity["promote_id"], $param["game_id"]);//get_game_selle_ratio($param["game_id"]); $data_spned['server_id'] = $param["server_id"]; $data_spned['server_name'] = $param["server_name"]; $data_spned['game_player_id'] = $param["game_player_id"]; diff --git a/Application/Sdk/Controller/ExchangeController.class.php b/Application/Sdk/Controller/ExchangeController.class.php index 013fab03..ee9ac681 100644 --- a/Application/Sdk/Controller/ExchangeController.class.php +++ b/Application/Sdk/Controller/ExchangeController.class.php @@ -193,19 +193,23 @@ class ExchangeController extends BaseController{ $istest = true; } - if (get_game_appstatus2($request['game_id']) || $istest/* &&$request['is_create_ordernumer']!=1 */){ /* 第三方支付 */ + // 是否是beta版苹果内购 + $isBeta = false; + if (isset($request['app_type']) && $request['app_type'] == 2) { + $isBeta = true; + } + if (get_game_appstatus2($request['game_id']) || $istest || !$isBeta/* &&$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; $request['pay_status'] = 0; - $request['pay_way'] = 7; $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(!get_game_appstatus2($request['game_id'])/* &&$request['is_create_ordernumer']==1 */){ /* 废弃 苹果支付 */ + } elseif(!get_game_appstatus2($request['game_id'] && $isBeta)/* &&$request['is_create_ordernumer']==1 */){ /* 废弃 苹果支付 */ #获取订单信息 $prefix = $request['code'] == 1 ? "SP_" : "PF_"; @@ -213,7 +217,7 @@ class ExchangeController extends BaseController{ $data = array("status"=>200,"out_trade_no"=>$out_trade_no,'is_third_app_pay'=>0); $request['pay_order_number'] = $out_trade_no; $request['pay_status'] = 0; - $request['pay_way'] = 7; + $request['pay_way'] = C("PAY_WAY.APPLE_PAY"); // $request['title'] = $request['productId']; $request['spend_ip'] = get_client_ip(); if($request['code'] == 1 ){ diff --git a/Application/Sdk/Controller/UserController.class.php b/Application/Sdk/Controller/UserController.class.php index 22ccc3bb..905dc887 100644 --- a/Application/Sdk/Controller/UserController.class.php +++ b/Application/Sdk/Controller/UserController.class.php @@ -2137,7 +2137,7 @@ class UserController extends BaseController $data['real_name'] = $user['real_name']; if (isset($data['idcard'])) { if (substr($data['idcard'], - 1) === 'X') { - $this -> set_message(1086, "fail", "身份证号码填写不正确,如有字母请小写"); + $this -> set_message(1086, "fail", "身份证不正确,字母请小写"); } $checkidcard = new \Think\Checkidcard(); $invidcard = $checkidcard -> checkIdentity($data['idcard']); diff --git a/ThinkPHP/Library/Think/Pay.class.php b/ThinkPHP/Library/Think/Pay.class.php index af718417..998dcc90 100644 --- a/ThinkPHP/Library/Think/Pay.class.php +++ b/ThinkPHP/Library/Think/Pay.class.php @@ -318,7 +318,7 @@ class Pay $spend_data['promote_id'] = $vo->getPromoteId(); $spend_data['promote_account'] = $vo->getPromoteName(); $spend_data['order_number'] = ""; - $spend_data['selle_ratio'] = $vo->getRatio(); + $spend_data['selle_ratio'] = getGameSelleRatio($spend_data['promote_id'], $spend_data['game_id']);//$vo->getRatio(); $spend_data['pay_order_number'] = $vo->getOrderNo(); $spend_data['props_name'] = $vo->getTitle(); $spend_data['cost'] = $vo->getFee();