落地页记录下载日志

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 User\Api\MemberApi;
use Base\Facade\Request; use Base\Facade\Request;
use Base\Service\ApplyService; use Base\Service\ApplyService;
use Base\Service\PackageDownloadLogService;
/** /**
* 前台公共控制器 * 前台公共控制器
@ -316,6 +317,14 @@ class HomeController extends Controller
$this->error('链接丢失'); $this->error('链接丢失');
} }
$packageDownloadLogService = new PackageDownloadLogService();
$packageDownloadLogService->add([
'user_id' => 0,
'game_id' => $gameId,
'promote_id' => $promoteId,
'type' => 1,
]);
if ($status == 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'), '.'); $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 { } else {

@ -7,6 +7,7 @@ use Think\Think;
use Base\Service\PromoteService; use Base\Service\PromoteService;
use Base\Facade\Request; use Base\Facade\Request;
use Base\Service\ApplyService; use Base\Service\ApplyService;
use Base\Service\PackageDownloadLogService;
/** /**
* @author elf<360197197@qq.com> * @author elf<360197197@qq.com>
@ -85,6 +86,14 @@ class PackageController extends Controller
if (Request::isAndroid()) { if (Request::isAndroid()) {
$this->gotoPkgUrl($packageUrl); $this->gotoPkgUrl($packageUrl);
} else if (Request::isIOS()) { } 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)); $plistUrl = substr($packageUrl, 1, strlen($packageUrl));
header("HTTP/1.1 303 See Other"); header("HTTP/1.1 303 See Other");
header("Location: "."itms-services://?action=download-manifest&url=" . C('DOMAIN_DOWNLOAD') . '/' . ltrim($plistUrl, '/')); 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;"> <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)"> <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> </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> --> <!-- <div class="title-two">第二步:点击下方按钮安装游戏</div> -->
<a href="#" class="mounting-btn lastStep">上一步</a> <a href="#" class="mounting-btn lastStep">上一步</a>
</div> </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__/ios9/js/layer/layer.js?VerNo=20190923" type="text/javascript"></script>
<script src="__STATIC__/js.cookie.min.js"></script> <script src="__STATIC__/js.cookie.min.js"></script>
<script> <script>
var curUserId = 0;
var gameId = parseInt("{$game.id}"); var gameId = parseInt("{$game.id}");
var promoteId = parseInt("{$promoteId}"); 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 = { var PhoneObj = {
i:60, i:60,
codeflag: true, 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() { function GetVerityCode() {
//刷新验证码 //刷新验证码
$("#verifyCode").attr("src", "/mobile.php?s=/Common/verify.html&id=" + Math.random()); $("#verifyCode").attr("src", "/mobile.php?s=/Common/verify.html&id=" + Math.random());
@ -774,7 +796,7 @@ var PhoneObj = {
}, },
success: function (result) { success: function (result) {
if (result.code == '0000') { if (result.code == '0000') {
setLoginStatus() setLoginStatus(result.data.user_id)
$(".commonWindow").hide(); $(".commonWindow").hide();
showMounting() showMounting()
} else { } else {
@ -784,11 +806,12 @@ var PhoneObj = {
}) })
}) })
function setLoginStatus() function setLoginStatus(userId)
{ {
var expireTime = new Date(new Date().getTime() + 10 * 60 * 1000); var expireTime = new Date(new Date().getTime() + 10 * 60 * 1000);
Cookies.set('is_landing_login', 1, { expires: expireTime }) Cookies.set('landing_login_user', userId, { expires: expireTime })
isLogin = true; isLogin = (curUserId == 0 ? false : true);
curUserId = userId
} }
function showMounting() function showMounting()
@ -836,7 +859,7 @@ var PhoneObj = {
cache: false, cache: false,
success: function (result) { success: function (result) {
if (result.code == '0000') { if (result.code == '0000') {
setLoginStatus() setLoginStatus(result.data.user_id)
$('.login').hide(); $('.login').hide();
showMounting() showMounting()
} else { } else {
@ -883,7 +906,7 @@ var PhoneObj = {
}, },
success: function (result) { success: function (result) {
if (result.code == '0000') { if (result.code == '0000') {
setLoginStatus() setLoginStatus(result.data.user_id)
$(".commonWindow").hide(); $(".commonWindow").hide();
showMounting() showMounting()
} else { } else {

@ -65,7 +65,7 @@ class CommonController extends BaseController {
'promote_account' => $promote['account'] '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(); $userApi = new MemberApi();
$userId = $userApi->login($params['account'], $params['password'], 1); $userId = $userApi->login($params['account'], $params['password'], 1);
$_SESSION['user_id'] = $userId; $_SESSION['user_id'] = $userId;
$this->respondSuccess('添加成功'); $this->setData(['user_id' => $userId])->respondSuccess('添加成功');
} }
//忘记密码 //忘记密码
@ -165,7 +165,7 @@ class CommonController extends BaseController {
$userApi = new MemberApi(); $userApi = new MemberApi();
$userId = $userApi->login($account, $password, 1); $userId = $userApi->login($account, $password, 1);
$_SESSION['user_id'] = $userId; $_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 Base\Tool\TaskClient;
use Think\Log; use Think\Log;
use Base\Service\GameService; use Base\Service\GameService;
use Base\Service\PackageDownloadLogService;
class SsgController extends BaseController { class SsgController extends BaseController {
const USER_NOT_ILLEGAL = -1; //用户名不合法 const USER_NOT_ILLEGAL = -1; //用户名不合法
@ -488,6 +489,15 @@ class SsgController extends BaseController {
))->find(); ))->find();
if($isPay){ 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']); redirect("/mobile.php/Ssg/install_show/user_id/$userId/game_id/$gameId/order_id/".$isPay['order_id']);
}else{ }else{
if (!$gameInfo['supersign_token']) { if (!$gameInfo['supersign_token']) {

Loading…
Cancel
Save