master
ELF 4 years ago
parent 23feb76e09
commit b495135215

@ -69,21 +69,7 @@ class PackageController extends Controller
$this->error('链接已失效');
}
$map = [];
$map['status'] = 1;
$map['enable_status'] = 1;
$map['game_id'] = $gameId;
$map['promote_id'] = $promoteId;
$columns = ['game_id', 'promote_id', 'promote_account', 'pack_url', 'plist_url', 'status', 'enable_status'];
$apply = M('apply','tab_')->field($columns)->where($map)->find();
if (!$apply) {
$this->redirect("package/downloadError", ['message' => '该链接已经停止使用']);
}
$game = M('game','tab_')->field(['id', 'game_name', 'sdk_version', 'apply_auth'])->where(['id' => $apply['game_id']])->find();
$sdkVersion = $game['sdk_version'];
$sdkVersion = 0;
if (Request::isMobile() || Request::isTablet() || $force == 'ios' || $force == 'android') {
if (Request::isAndroid() || $force == 'android') {
$sdkVersion = 1;
@ -92,14 +78,31 @@ class PackageController extends Controller
}
}
$gameColumns = ['id', 'game_name', 'sdk_version', 'apply_auth', 'relation_game_id'];
$game = M('game','tab_')->field($gameColumns)->where(['id' => $gameId])->find();
if ($sdkVersion > 0 && $game && $game['sdk_version'] != $sdkVersion) {
$game = M('game','tab_')->field($gameColumns)->where(['sdk_version' => $sdkVersion, 'relation_game_id' => $game['relation_game_id']])->find();
}
if (!$game) {
$this->error('游戏不存在');
}
$map = [];
$map['status'] = 1;
$map['enable_status'] = 1;
$map['game_id'] = $game['game_id'];
$map['promote_id'] = $promoteId;
$apply = M('apply','tab_')->where($map)->find();
if (!$apply) {
$this->redirect("package/downloadError", ['message' => '该链接已经停止使用']);
}
$packageUrl = $sdkVersion == 1 ? $apply['pack_url'] : $apply['plist_url'];
$apply = M('apply', 'tab_')->where(['promote_id' => $promoteId, 'game_id' => $gameId])->find();
$url = $applyService->getLandingPageUrl($apply, $code);
M('game','tab_')->where(['id' => $game['id']])->setInc('dow_num');
$log['game_id'] = $gameId;
$log['game_id'] = $game['id'];
$log['game_name'] = $game['game_name'];
$log['action'] = $url;
$log['type'] = 6;
@ -114,7 +117,7 @@ class PackageController extends Controller
$packageDownloadLogService = new PackageDownloadLogService();
$packageDownloadLogService->add([
'user_id' => 0,
'game_id' => $gameId,
'game_id' => $game['id'],
'promote_id' => $promoteId,
'type' => 1,
]);

Loading…
Cancel
Save