From 79f9801351d0a0df76ac8f16c24629c0dc160262 Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Thu, 16 Jan 2020 17:36:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=90=BD=E5=9C=B0=E9=A1=B5/?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Base/Service/ApplyService.class.php | 12 ++++++++ .../Home/Controller/ApplyController.class.php | 29 +++++++++++++------ .../Home/Controller/HomeController.class.php | 10 ++++++- .../Controller/PackageController.class.php | 12 +++++++- 4 files changed, 52 insertions(+), 11 deletions(-) diff --git a/Application/Base/Service/ApplyService.class.php b/Application/Base/Service/ApplyService.class.php index 5590f5924..3a963339e 100644 --- a/Application/Base/Service/ApplyService.class.php +++ b/Application/Base/Service/ApplyService.class.php @@ -197,4 +197,16 @@ class ApplyService { parse_str($items['query'], $params); return $params; } + + public function checkSociatyPerm($promote, $game) + { + $promoteService = new PromoteService(); + $topPromote = $promoteService->getTopPromote($promote); + $record = M('sociaty_games', 'tab_')->where(['game_id' => $game['id'], 'promote_id' => $topPromote['id']])->find(); + if ($record['status'] == 1) { + return true; + } else { + return false; + } + } } \ No newline at end of file diff --git a/Application/Home/Controller/ApplyController.class.php b/Application/Home/Controller/ApplyController.class.php index 18b02e1b3..c781cdaab 100644 --- a/Application/Home/Controller/ApplyController.class.php +++ b/Application/Home/Controller/ApplyController.class.php @@ -66,11 +66,11 @@ class ApplyController extends BaseController { $loginPromote = $this->getLoginPromote(); - $promoteId = empty(I('promote_id')) ? $loginPromote['id'] : I('promote_id');//搜索的渠道ID - $promoteRole = empty(I('promote_role')) ? 1 : I('promote_role');//渠道角色 - $parentPromoteId = getParentPromoteId($promoteId);//上级渠道ID - $grandPromoteId = getGrandPromoteId($promoteId);//本账号会长渠道ID - $childGameAddPermission = getChildGameAddPermission($grandPromoteId);//游戏添加权限 + $promoteId = empty(I('promote_id')) ? $loginPromote['id'] : I('promote_id'); //搜索的渠道ID + $promoteRole = empty(I('promote_role')) ? 1 : I('promote_role'); //渠道角色 + $parentPromoteId = getParentPromoteId($promoteId); //上级渠道ID + $grandPromoteId = getGrandPromoteId($promoteId); //本账号会长渠道ID + $childGameAddPermission = getChildGameAddPermission($grandPromoteId); //游戏添加权限 $map['tab_game.online_status'] = 1;//开发者游戏上线状态 $map['tab_game.down_port'] = 1;//游戏端口 第三方接口不能申请 @@ -1622,17 +1622,28 @@ class ApplyController extends BaseController $gameData['sdk_name'] = getSDKTypeName($gameData['sdk_version']); - $promoteIds = getAllPromoteListByType($promoteType); + $promotes = getAllPromoteListByType($promoteType); + + M('apply', 'tab_')->where(array('game_id' => $gameId, 'promote_id' => $value['id'], 'offline_status' => 0))->count('id'); $newPromoteData = []; - if (count($promoteIds) > 0) { - foreach ($promoteIds as $value) { + if (count($promotes) > 0) { + + $promoteIds = array_column($promotes, 'id'); + $oldIds = M('apply', 'tab_')->where(['game_id' => $gameId, 'promote_id' => ['in', $promoteIds], 'offline_status' => 0])->getField('id', true); + $newPromoteIds = array_diff($promoteIds, $oldIds); + foreach ($promotes as $promote) { + if (in_array($promote['id'], $newPromoteIds)) { + $newPromoteData[] = $promote; + } + } + /* foreach ($promoteIds as $value) { $thisPromote = M('apply', 'tab_')->where(array('game_id' => $gameId, 'promote_id' => $value['id'], 'offline_status' => 0))->count('id'); if (!$thisPromote) { $newPromoteData[] = $value; } - } + } */ } $data['game_data'] = $gameData; diff --git a/Application/Home/Controller/HomeController.class.php b/Application/Home/Controller/HomeController.class.php index aaed98006..0d2991cbf 100644 --- a/Application/Home/Controller/HomeController.class.php +++ b/Application/Home/Controller/HomeController.class.php @@ -154,8 +154,8 @@ class HomeController extends Controller $this->error('该链接已被禁'); } + $applyService = new ApplyService(); if ($code != '') { - $applyService = new ApplyService(); $data = $applyService->decodeApplyCode($code); $result = $applyService->checkApplyCode($data, ApplyService::ENCRYPT_TYPE_LANDING_PAGE); if (!$result['status']) { @@ -194,6 +194,11 @@ class HomeController extends Controller $map = ['id' => intval($gameId)]; $game = M('game', 'tab_')->field($columns)->where($map)->find(); + $promote = M('promote', 'tab_')->field(['id', 'parent_id', 'chain', 'level'])->where(['id' => $promoteId])->find(); + if (!$applyService->checkSociatyPerm($promote, $game)) { + $this->error('该链接已经停止使用'); + } + if ($game['sdk_version'] == 1 && $isIOS) { $map = []; $map['relation_game_id'] = $game['relation_game_id']; @@ -208,6 +213,9 @@ class HomeController extends Controller $apply = M('apply', 'tab_')->field(['game_id', 'enable_status', 'promote_id']) ->where(['promote_id' => $promoteId, 'game_id' => $game['id']]) ->find(); + if (!$apply) { + $this->error('该链接已经停止使用'); + } $game['icon'] = get_cover($game['icon'], 'path'); $gameSource = M('GameSource', 'tab_')->field(['create_time', 'org_plist_url', 'is_new_sdk'])->where(array('game_id' => $game['id']))->find(); diff --git a/Application/Home/Controller/PackageController.class.php b/Application/Home/Controller/PackageController.class.php index 09f329745..09f09ed18 100644 --- a/Application/Home/Controller/PackageController.class.php +++ b/Application/Home/Controller/PackageController.class.php @@ -40,8 +40,9 @@ class PackageController extends Controller if ($isBlack) { $this->redirect("package/downloadError", ['message' => '该链接已被禁']); } + + $applyService = new ApplyService(); if ($code != '') { - $applyService = new ApplyService(); $data = $applyService->decodeApplyCode($code); $result = $applyService->checkApplyCode($data, ApplyService::ENCRYPT_TYPE_DOWNLOAD); if (!$result['status']) { @@ -59,7 +60,16 @@ class PackageController extends Controller $map['promote_id'] = $promoteId; $columns = ['game_id', 'promote_id', 'promote_account', 'pack_url', 'plist_url', 'status', 'enable_status']; $apply = M('apply','tab_')->field($columns)->where($map)->find(); + if (!$apply) { + $this->redirect("package/downloadError", ['message' => '该链接已经停止使用']); + } + + $promote = M('promote', 'tab_')->field(['id', 'parent_id', 'chain', 'level'])->where(['id' => $promoteId])->find(); $game = M('game','tab_')->field(['id', 'game_name', 'sdk_version'])->where(['id' => $apply['game_id']])->find(); + if (!$applyService->checkSociatyPerm($promote, $game)) { + $this->redirect("package/downloadError", ['message' => '该链接已经停止使用']); + } + if (Request::isMobile()) { if (!Request::isAndroid() && $game['sdk_version'] == 1) {