From 6e354fe3b3b6727e5615e8aada869e9bdf386104 Mon Sep 17 00:00:00 2001 From: "elf@home" <360197197@qq.com> Date: Sun, 29 Dec 2019 23:36:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=93=BE=E6=8E=A5=E5=BD=92?= =?UTF-8?q?=E5=B1=9E=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/PromoteController.class.php | 66 +++++++++++-------- Application/Admin/View/Promote/linkInfo.html | 23 ++----- .../Base/Service/ApplyService.class.php | 55 ++++++++++++++++ 3 files changed, 98 insertions(+), 46 deletions(-) diff --git a/Application/Admin/Controller/PromoteController.class.php b/Application/Admin/Controller/PromoteController.class.php index b53e4ffc9..46954063b 100644 --- a/Application/Admin/Controller/PromoteController.class.php +++ b/Application/Admin/Controller/PromoteController.class.php @@ -1102,42 +1102,52 @@ class PromoteController extends ThinkController public function linkInfo() { $link = $_REQUEST['link']; - $strCode = "code/"; - $link_type = $_REQUEST['link_type']; - $linkArr = strstr ( $link , $strCode ); - $length = strlen($strCode); - $code = substr($linkArr, $length); - //$this->display(); + $applyServe = new ApplyService(); - $codeRes = $applyServe->decodeApplyCode($code); - $promote_id = $codeRes['promote_id']; - $game_id = $codeRes["game_id"]; - $promoteInfo = M('promote','tab_')->field('account')->where(['id'=>$promote_id])->find(); + $identifier = $applyServe->getPageIdentifier($link); + if (!$identifier) { + $this->assign('error', '链接异常'); + return $this->display(); + } + $promoteId = 0; + $gameId = 0; + $createdAt = '无法获知'; + $expiresIn = 0; + $realType = 0; + if (isset($identifier['code'])) { + $result = $applyServe->decodeApplyCode($identifier['code']); + if (!$result) { + $this->assign('error', '解码异常'); + return $this->display(); + } + $promoteId = $result['promote_id']; + $gameId = $result["game_id"]; + $expiresIn = $result['expires_in']; + $createdAt = $result['created_at']; + $realType = $result['type']; + } else if(isset($identifier['promote_id']) && isset($identifier['game_id'])) { + $promoteId = $identifier['promote_id']; + $gameId = $identifier["game_id"]; + $realType = $identifier['type']; + } + + $promoteInfo = M('promote','tab_')->field('account')->where(['id'=>$promoteId])->find(); $params['account'] = $promoteInfo['account']; - $game_id = $codeRes['game_id']; - $gameInfo = M('game','tab_')->field('game_name')->where(['id'=>$game_id])->find(); + $gameInfo = M('game','tab_')->field('game_name')->where(['id'=>$gameId])->find(); $params['game_name'] = $gameInfo['game_name']; - if(!empty($codeRes)) { - $expires_in = $codeRes['expires_in']; - }else { - $expires_in = -100; - } - if($expires_in == 0) { + if($expiresIn == 0) { $params['expires_in'] = "永久性"; - }else if($expires_in > 0) { - $params['expires_in'] = $expires_in; + }else if($expiresIn > 0) { + $params['expires_in'] = $expiresIn; } - $params['created_at'] = $codeRes['created_at']; - if($codeRes['type'] == 1) { - $params['type'] = '复制下载链接'; - }else if($codeRes['type'] == 2) { + $params['created_at'] = $createdAt; + if($realType == 1) { + $params['type'] = '下载链接'; + } else if($realType == 2) { $params['type'] = '落地页链接'; } - if($codeRes['type'] == $link_type || $link_type == 0) { - $this->assign('params',$params); - } + $this->assign('params',$params); $this->display(); - } } diff --git a/Application/Admin/View/Promote/linkInfo.html b/Application/Admin/View/Promote/linkInfo.html index 11a562686..35e84734b 100644 --- a/Application/Admin/View/Promote/linkInfo.html +++ b/Application/Admin/View/Promote/linkInfo.html @@ -52,25 +52,12 @@