落地页记录下载日志

master
ELF 5 years ago
parent 82bd30c4d4
commit a06b199068

@ -0,0 +1,24 @@
<?php
namespace Base\Service;
use Base\Facade\Request;
class PackageDownloadLogService
{
public function add(array $params)
{
$userId = intval($params['user_id'] ?? 0);
$gameId = intval($params['game_id'] ?? 0);
$promoteId = intval($params['promote_id'] ?? 0);
$type = intval($params['type'] ?? 0);
return M('package_download_log', 'tab_')->add([
'user_id' => $userId,
'game_id' => $gameId,
'promote_id' => $promoteId,
'type' => $type,
'create_time' => time()
]);
}
}

@ -5,6 +5,7 @@ use Think\Controller;
use User\Api\MemberApi;
use Base\Facade\Request;
use Base\Service\ApplyService;
use Base\Service\PackageDownloadLogService;
/**
* 前台公共控制器
@ -316,6 +317,14 @@ class HomeController extends Controller
$this->error('链接丢失');
}
$packageDownloadLogService = new PackageDownloadLogService();
$packageDownloadLogService->add([
'user_id' => 0,
'game_id' => $gameId,
'promote_id' => $promoteId,
'type' => 1,
]);
if ($status == 1) {
$downLink = 'itms-services://?action=download-manifest&url=' . "https://" . $_SERVER["HTTP_HOST"] . ltrim(M('GameSource', 'tab_')->where(array('game_id' => $gameId))->getField('org_plist_url'), '.');
} else {

@ -7,6 +7,7 @@ use Think\Think;
use Base\Service\PromoteService;
use Base\Facade\Request;
use Base\Service\ApplyService;
use Base\Service\PackageDownloadLogService;
/**
* @author elf<360197197@qq.com>
@ -85,6 +86,14 @@ class PackageController extends Controller
if (Request::isAndroid()) {
$this->gotoPkgUrl($packageUrl);
} else if (Request::isIOS()) {
$packageDownloadLogService = new PackageDownloadLogService();
$packageDownloadLogService->add([
'user_id' => 0,
'game_id' => $gameId,
'promote_id' => $promoteId,
'type' => 1,
]);
$plistUrl = substr($packageUrl, 1, strlen($packageUrl));
header("HTTP/1.1 303 See Other");
header("Location: "."itms-services://?action=download-manifest&url=" . C('DOMAIN_DOWNLOAD') . '/' . ltrim($plistUrl, '/'));
@ -113,4 +122,21 @@ class PackageController extends Controller
}
}
}
public function addDownloadLog()
{
$params = I('.post');
$packageDownloadLogService = new PackageDownloadLogService();
if ($packageDownloadLogService->add($params)) {
$this->ajaxReturn([
'status' => true,
'message' => '记录成功'
]);
} else {
$this->ajaxReturn([
'status' => false,
'message' => '系统异常'
]);
}
}
}

@ -557,7 +557,7 @@ background:rgba(0,0,0,0.6); z-index: 999;display: none;"></div>
<div class="title-one" style="width: 4.06rem;padding: 0;margin-bottom: 0;">
<img src="__IMG__/20191225/bg.png" alt="" style="width: 100%;height: 100%;box-shadow:0px 0px 6px 0px rgba(109,121,145,0.2)">
</div>
<a id="beta-url" href="{$game['beta_url']}" class="mounting-btn">点击安装游戏</a>
<a id="beta-url" href="javascript:;" class="mounting-btn">点击安装游戏</a>
<!-- <div class="title-two">第二步:点击下方按钮安装游戏</div> -->
<a href="#" class="mounting-btn lastStep">上一步</a>
</div>
@ -569,9 +569,12 @@ background:rgba(0,0,0,0.6); z-index: 999;display: none;"></div>
<script src="__STATIC__/ios9/js/layer/layer.js?VerNo=20190923" type="text/javascript"></script>
<script src="__STATIC__/js.cookie.min.js"></script>
<script>
var curUserId = 0;
var gameId = parseInt("{$game.id}");
var promoteId = parseInt("{$promoteId}");
var isLogin = Cookies.get('is_landing_login') == undefined ? false : true;
var betaUrl = "{$game['beta_url']}";
curUserId = Cookies.get('landing_login_user') == undefined ? 0 : Cookies.get('landing_login_user');
var isLogin = (curUserId == 0 ? false : true);
var PhoneObj = {
i:60,
codeflag: true,
@ -741,6 +744,25 @@ var PhoneObj = {
}
})
$('#beta-url').on({
click: function () {
$.ajax({
type: 'POST',
url: '/index.php?s=/Home/Package/addDownloadLog.html',
dataType: 'JSON',
data:{
user_id: curUserId,
promote_id: promoteId,
game_id: gameId,
type: 2
},
success: function (result) {
window.location.href = betaUrl
}
})
}
})
function GetVerityCode() {
//刷新验证码
$("#verifyCode").attr("src", "/mobile.php?s=/Common/verify.html&id=" + Math.random());
@ -774,7 +796,7 @@ var PhoneObj = {
},
success: function (result) {
if (result.code == '0000') {
setLoginStatus()
setLoginStatus(result.data.user_id)
$(".commonWindow").hide();
showMounting()
} else {
@ -784,11 +806,12 @@ var PhoneObj = {
})
})
function setLoginStatus()
function setLoginStatus(userId)
{
var expireTime = new Date(new Date().getTime() + 10 * 60 * 1000);
Cookies.set('is_landing_login', 1, { expires: expireTime })
isLogin = true;
Cookies.set('landing_login_user', userId, { expires: expireTime })
isLogin = (curUserId == 0 ? false : true);
curUserId = userId
}
function showMounting()
@ -836,7 +859,7 @@ var PhoneObj = {
cache: false,
success: function (result) {
if (result.code == '0000') {
setLoginStatus()
setLoginStatus(result.data.user_id)
$('.login').hide();
showMounting()
} else {
@ -883,7 +906,7 @@ var PhoneObj = {
},
success: function (result) {
if (result.code == '0000') {
setLoginStatus()
setLoginStatus(result.data.user_id)
$(".commonWindow").hide();
showMounting()
} else {

@ -65,7 +65,7 @@ class CommonController extends BaseController {
'promote_account' => $promote['account']
]);
}
$this->respondSuccess($resMsg);
$this->setData(['user_id' => $userId])->respondSuccess($resMsg);
}
//验证码
@ -119,7 +119,7 @@ class CommonController extends BaseController {
$userApi = new MemberApi();
$userId = $userApi->login($params['account'], $params['password'], 1);
$_SESSION['user_id'] = $userId;
$this->respondSuccess('添加成功');
$this->setData(['user_id' => $userId])->respondSuccess('添加成功');
}
//忘记密码
@ -165,7 +165,7 @@ class CommonController extends BaseController {
$userApi = new MemberApi();
$userId = $userApi->login($account, $password, 1);
$_SESSION['user_id'] = $userId;
$this->respondSuccess('注册成功');
$this->setData(['user_id' => $userId])->respondSuccess('注册成功');
}
//真正注册代码

@ -6,6 +6,7 @@ use User\Api\MemberApi;
use Base\Tool\TaskClient;
use Think\Log;
use Base\Service\GameService;
use Base\Service\PackageDownloadLogService;
class SsgController extends BaseController {
const USER_NOT_ILLEGAL = -1; //用户名不合法
@ -488,6 +489,15 @@ class SsgController extends BaseController {
))->find();
if($isPay){
$packageDownloadLogService = new PackageDownloadLogService();
$packageDownloadLogService->add([
'user_id' => $userId,
'game_id' => $gameId,
'promote_id' => $promoteId,
'type' => 3,
]);
redirect("/mobile.php/Ssg/install_show/user_id/$userId/game_id/$gameId/order_id/".$isPay['order_id']);
}else{
if (!$gameInfo['supersign_token']) {

Loading…
Cancel
Save