From bcc4b10bd655c187e51ace426b2c497d8a269f6e Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Thu, 7 Nov 2019 11:26:45 +0800 Subject: [PATCH] =?UTF-8?q?=E8=90=BD=E5=9C=B0=E9=A1=B5/=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E9=A1=B5=E6=B7=BB=E5=8A=A0=E6=97=A7=E7=89=88=E5=85=BC=E5=AE=B9?= =?UTF-8?q?=E5=8F=8A=E9=93=BE=E6=8E=A5=E9=BB=91=E5=90=8D=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Home/Controller/DownController.class.php | 4 +++ .../Controller/DownloadController.class.php | 28 ++++++++++----- .../Home/Controller/HomeController.class.php | 35 ++++++++++++++----- 3 files changed, 49 insertions(+), 18 deletions(-) diff --git a/Application/Home/Controller/DownController.class.php b/Application/Home/Controller/DownController.class.php index 5a68b07ee..86be86ba4 100644 --- a/Application/Home/Controller/DownController.class.php +++ b/Application/Home/Controller/DownController.class.php @@ -14,6 +14,10 @@ class DownController extends Controller { $this->display(); } public function down_file($game_id=0,$promote_id=0){ + // 旧版兼容 + A('Download')->index(); + die(); + $applyModel = M('Apply','tab_'); $map['status'] = 1; $map['enable_status'] = 1; diff --git a/Application/Home/Controller/DownloadController.class.php b/Application/Home/Controller/DownloadController.class.php index dc69d5d83..327f99517 100644 --- a/Application/Home/Controller/DownloadController.class.php +++ b/Application/Home/Controller/DownloadController.class.php @@ -19,18 +19,28 @@ class DownloadController extends Controller { public function index() { $code = I('code', ''); - if ($code == '') { + $gameId = I('game_id', 0); + $promoteId = I('promote_id', 0); + + if ($code == '' && ($gameId == 0 || $promoteId == 0)) { $this->redirect("download/downloadError", ['message' => '访问错误']); } - $applyService = new ApplyService(); - $data = $applyService->decodeApplyCode($code); - $result = $applyService->checkApplyCode($data, ApplyService::ENCRYPT_TYPE_DOWNLOAD); - if (!$result['status']) { - $this->error($result['message']); + + $blackList = []; + if (in_array($code, $blackList) || in_array('game_id/' . $gameId . '/promote_id/' . $promoteId, $blackList)) { + $this->redirect("download/downloadError", ['message' => '该链接已被禁']); + } + if ($code != '') { + $applyService = new ApplyService(); + $data = $applyService->decodeApplyCode($code); + $result = $applyService->checkApplyCode($data, ApplyService::ENCRYPT_TYPE_DOWNLOAD); + if (!$result['status']) { + $this->error($result['message']); + } + + $gameId = $data['game_id']; + $promoteId = $data['promote_id']; } - - $gameId = $data['game_id']; - $promoteId = $data['promote_id']; $map = []; $map['status'] = 1; diff --git a/Application/Home/Controller/HomeController.class.php b/Application/Home/Controller/HomeController.class.php index 2c0e2155b..bdba456a4 100644 --- a/Application/Home/Controller/HomeController.class.php +++ b/Application/Home/Controller/HomeController.class.php @@ -101,6 +101,10 @@ class HomeController extends Controller public function promitionofregestion() { + // 旧版兼容 + A('Home')->landingPage(); + die(); + $gameData = M('Game', 'tab_') ->field('relation_game_id,sdk_version') ->where(array('id' => intval($_GET['gid']))) @@ -131,14 +135,27 @@ class HomeController extends Controller public function landingPage() { $code = I('code', ''); - if ($code == '') { - $this->redirect("download/downloadError", ['message' => '访问错误']); + $gameId = I('gid', 0); + $promoteId = I('pid', 0); + + if ($code == '' && ($gameId == 0 || $promoteId == 0)) { + $this->error('访问错误'); + } + $blackList = []; + if (in_array($code, $blackList) || in_array('gid/' . $gameId . '/pid/' . $promoteId, $blackList)) { + $this->error('该链接已被禁'); } - $applyService = new ApplyService(); - $data = $applyService->decodeApplyCode($code); - $result = $applyService->checkApplyCode($data, ApplyService::ENCRYPT_TYPE_LANDING_PAGE); - if (!$result['status']) { - $this->error($result['message']); + + if ($code != '') { + $applyService = new ApplyService(); + $data = $applyService->decodeApplyCode($code); + $result = $applyService->checkApplyCode($data, ApplyService::ENCRYPT_TYPE_LANDING_PAGE); + if (!$result['status']) { + $this->error($result['message']); + } + + $gameId = $data['game_id']; + $promoteId = $data['promote_id']; } $isWechat = Request::isWechat(); @@ -157,7 +174,7 @@ class HomeController extends Controller 'features', 'flooring_page_imgs', ]; - $map = ['id' => intval($data['game_id'])]; + $map = ['id' => intval($gameId)]; $game = M('game', 'tab_')->field($columns)->where($map)->find(); @@ -171,7 +188,7 @@ class HomeController extends Controller $game = M('game', 'tab_')->field($columns)->where($map)->find(); } $apply = M('apply', 'tab_')->field(['game_id', 'enable_status', 'promote_id']) - ->where(['promote_id' => $data['promote_id'], 'game_id' => $game['id']]) + ->where(['promote_id' => $promoteId, 'game_id' => $game['id']]) ->find(); $game['icon'] = get_cover($game['icon'], 'path');