diff --git a/Application/Admin/Controller/MemberController.class.php b/Application/Admin/Controller/MemberController.class.php index afde5599c..c57b0849f 100644 --- a/Application/Admin/Controller/MemberController.class.php +++ b/Application/Admin/Controller/MemberController.class.php @@ -1231,6 +1231,24 @@ class MemberController extends ThinkController } $list = M('device_bans', 'tab_')->where($map)->page($p, $row)->select(); $count = M('device_bans', 'tab_')->where($map)->count(); + if (!empty($list)) { + foreach ($list as &$item) { + switch ($item['type']) { + case '1': + $item['type_name'] = '设备号'; + break; + case '2': + $item['type_name'] = 'IP'; + break; + case '3': + $item['type_name'] = '落地页链接'; + break; + case '4': + $item['type_name'] = '下载链接'; + break; + } + } + } $page = set_pagination($count, $row); if ($page) { $this->assign('_page', $page); @@ -1249,9 +1267,15 @@ class MemberController extends ThinkController if (empty($type) || empty($tag)) { return $this->error("请填写完整信息"); } + if (\in_array($type, [3,4]) && !preg_match("/^((https|http|ftp|rtsp|mms)?:\/\/)[^\s]+/i", $tag)) { + return $this->error("请填写正确的url地址"); + } if ($type == 2 && !preg_match("/(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}/i", $tag)) { return $this->error("请填写正确的ip信息,如127.0.0.1"); } + if ($type == 1 && (preg_match("/(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}/i", $tag) || preg_match("/^((https|http|ftp|rtsp|mms)?:\/\/)[^\s]+/i", $tag))) { + return $this->error("请填写正确的设备信息"); + } $map['type'] = $type; $map['tag'] = $tag; $item = M('device_bans', 'tab_')->where($map)->find(); diff --git a/Application/Admin/View/Member/device_bans_edit.html b/Application/Admin/View/Member/device_bans_edit.html index 275ac0adc..5d1ba903d 100644 --- a/Application/Admin/View/Member/device_bans_edit.html +++ b/Application/Admin/View/Member/device_bans_edit.html @@ -11,10 +11,13 @@
  • - + +
  • diff --git a/Application/Admin/View/Member/device_bans_list.html b/Application/Admin/View/Member/device_bans_list.html index e3549e2bf..9eb370005 100644 --- a/Application/Admin/View/Member/device_bans_list.html +++ b/Application/Admin/View/Member/device_bans_list.html @@ -48,6 +48,8 @@ + +
    @@ -95,7 +97,7 @@ {$data.id} - + {$data.type_name} {$data.tag} {:get_admin_nickname($data['operator_id'])} {$data.create_time|date='Y-m-d H:i:s',###} diff --git a/Application/Base/Service/PromoteService.class.php b/Application/Base/Service/PromoteService.class.php index a8d5e1e7c..79fa51a05 100644 --- a/Application/Base/Service/PromoteService.class.php +++ b/Application/Base/Service/PromoteService.class.php @@ -958,4 +958,54 @@ class PromoteService { return M('promote', 'tab_')->add($data); } + + public function getLandingPageIdentifier($url) + { + $code = $this->getUrlParam($url, 'code'); + if ($code === null) { + $pid = $this->getUrlParam($url, 'gid'); + $gid = $this->getUrlParam($url, 'pid'); + if ($gid === null || $gid === null) { + return null; + } else { + return $gid . '-' . $pid; + } + } + return $code; + } + + public function getDownloadIdentifier($url) + { + $code = $this->getUrlParam($url, 'code'); + if ($code === null) { + $pid = $this->getUrlParam($url, 'game_id'); + $gid = $this->getUrlParam($url, 'promote_id'); + if ($gid === null || $gid === null) { + return null; + } else { + return $gid . '-' . $pid; + } + } + return $code; + } + + private function getUrlParam($url, $name) + { + $items = parse_url($url); + $queryString = ltrim($items['query'], 's='); + $queryString = ltrim($queryString, '/'); + $queryString = rtrim($queryString, '.html'); + $rows = explode('/', $queryString); + $codeIndex = null; + foreach ($rows as $key => $value) { + if ($key >= 3 && $value == $name) { + $codeIndex = $key; + break; + } + } + if ($codeIndex !== null) { + return $rows[$codeIndex + 1] ?? null; + } + return null; + } } \ No newline at end of file diff --git a/Application/Home/Controller/HomeController.class.php b/Application/Home/Controller/HomeController.class.php index dc41372b5..5a0a198ad 100644 --- a/Application/Home/Controller/HomeController.class.php +++ b/Application/Home/Controller/HomeController.class.php @@ -141,8 +141,10 @@ class HomeController extends Controller if ($code == '' && ($gameId == 0 || $promoteId == 0)) { $this->error('访问错误'); } - $blackList = []; - if (in_array($code, $blackList) || in_array('gid/' . $gameId . '/pid/' . $promoteId, $blackList)) { + + $identifier = $code != '' ? $code : 'gid/' . $gameId . '/pid/' . $promoteId; + $isBlack = M('device_bans', 'tab_')->where(['type' => 3, 'tag' => ['like', '%' . $identifier . '%']])->limit(1)->getField('id'); + if ($isBlack) { $this->error('该链接已被禁'); } @@ -227,6 +229,8 @@ class HomeController extends Controller $this->assign('apply', $apply); $this->assign('game', $game); $this->assign('promoteId', $promoteId); + $cur_url = base64_encode(base64_encode("http://" . $_SERVER['HTTP_HOST'] . __SELF__)); + $this->assign('cur_url', $cur_url); $this->display('landingPage'); } diff --git a/Application/Home/Controller/PackageController.class.php b/Application/Home/Controller/PackageController.class.php index ebd8279c8..830606409 100644 --- a/Application/Home/Controller/PackageController.class.php +++ b/Application/Home/Controller/PackageController.class.php @@ -30,13 +30,14 @@ class PackageController extends Controller $code = I('code', ''); $gameId = I('game_id', 0); $promoteId = I('promote_id', 0); -// var_dump($gameId, $promoteId);die(); + if ($code == '' && ($gameId == 0 || $promoteId == 0)) { $this->redirect("package/downloadError", ['message' => '访问错误']); } - $blackList = []; - if (in_array($code, $blackList) || in_array('game_id/' . $gameId . '/promote_id/' . $promoteId, $blackList)) { + $identifier = $code != '' ? $code : 'game_id/' . $gameId . '/promote_id/' . $promoteId; + $isBlack = M('device_bans', 'tab_')->where(['type' => 4, 'tag' => ['like', '%' . $identifier . '%']])->limit(1)->getField('id'); + if ($isBlack) { $this->redirect("package/downloadError", ['message' => '该链接已被禁']); } if ($code != '') { diff --git a/Data/update.sql b/Data/update.sql index 924ff99c5..1490c7dbf 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -608,4 +608,8 @@ promote_account_to:修改后账号 remark:备注 create_time:时间 op_account:操作人账号 -order_time:切分时间' WHERE `id` = 29; \ No newline at end of file +order_time:切分时间' WHERE `id` = 29; + +--新增风控类型 +ALTER TABLE `tab_device_bans` +MODIFY COLUMN `type` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '类型 0未知 1设备号 2IP 3落地页链接 4下载链接' AFTER `tag`;