修改bug

master
ELF 5 years ago
parent bd46fd325b
commit 81a968947b

@ -958,4 +958,54 @@ class PromoteService {
return M('promote', 'tab_')->add($data); 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;
}
} }

@ -142,8 +142,9 @@ class HomeController extends Controller
$this->error('访问错误'); $this->error('访问错误');
} }
$blackList = M('device_bans', 'tab_')->where(['type' => 3])->getField('tag', true); $identifier = $code != '' ? $code : 'gid/' . $gameId . '/pid/' . $promoteId;
if (in_array($code, $blackList) || in_array('gid/' . $gameId . '/pid/' . $promoteId, $blackList)) { $isBlack = M('device_bans', 'tab_')->where(['type' => 3, 'tag' => ['like', '%' . $identifier . '%']])->limit(1)->getField('id');
if ($isBlack) {
$this->error('该链接已被禁'); $this->error('该链接已被禁');
} }
@ -228,6 +229,8 @@ class HomeController extends Controller
$this->assign('apply', $apply); $this->assign('apply', $apply);
$this->assign('game', $game); $this->assign('game', $game);
$this->assign('promoteId', $promoteId); $this->assign('promoteId', $promoteId);
$cur_url = base64_encode(base64_encode("http://" . $_SERVER['HTTP_HOST'] . __SELF__));
$this->assign('cur_url', $cur_url);
$this->display('landingPage'); $this->display('landingPage');
} }

@ -35,8 +35,9 @@ class PackageController extends Controller
$this->redirect("package/downloadError", ['message' => '访问错误']); $this->redirect("package/downloadError", ['message' => '访问错误']);
} }
$blackList = M('device_bans', 'tab_')->where(['type' => 4])->getField('tag', true); $identifier = $code != '' ? $code : 'game_id/' . $gameId . '/promote_id/' . $promoteId;
if (in_array($code, $blackList) || in_array('game_id/' . $gameId . '/promote_id/' . $promoteId, $blackList)) { $isBlack = M('device_bans', 'tab_')->where(['type' => 4, 'tag' => ['like', '%' . $identifier . '%']])->limit(1)->getField('id');
if ($isBlack) {
$this->redirect("package/downloadError", ['message' => '该链接已被禁']); $this->redirect("package/downloadError", ['message' => '该链接已被禁']);
} }
if ($code != '') { if ($code != '') {

Loading…
Cancel
Save