落地页/下载页添加旧版兼容及链接黑名单

master
ELF 5 years ago
parent 831456b333
commit bcc4b10bd6

@ -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;

@ -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;

@ -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');

Loading…
Cancel
Save