Merge branch 'dev'

master
ELF 5 years ago
commit 896065777b

@ -55,26 +55,42 @@ class HomeController extends Controller
$secret = 'd3219c70a45c5e1954be4608b288d38b'; $secret = 'd3219c70a45c5e1954be4608b288d38b';
$tokenUrl = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' . $appid . '&secret=' . $secret; $tokenUrl = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' . $appid . '&secret=' . $secret;
$result = file_get_contents($tokenUrl); $content = file_get_contents(RUNTIME_PATH . 'Data/wechat_ticket');
$result = json_decode($result, true); $ticketData = null;
if (!$result || isset($result['errcode'])) { if ($content) {
$this->ajaxReturn([ $ticketData = json_decode($content, true);
'status' => false,
'msg' => '获取失败',
]);
} }
$accessToken = $result['access_token'];
$isExpired = false;
$ticketUrl = 'https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=' . $accessToken . '&type=jsapi'; if ($ticketData) {
$result = file_get_contents($ticketUrl); $isExpired = time() > $ticketData['expired_at'] ? true : false;
$result = json_decode($result, true); }
if (!$result || $result['errcode'] != 0) {
$this->ajaxReturn([ $ticket = '';
'status' => false, if (!$ticketData || $isExpired) {
'msg' => '获取失败', $ticket = $ticketData['ticket'];
]); $result = file_get_contents($tokenUrl);
$result = json_decode($result, true);
if (!$result || isset($result['errcode'])) {
$this->ajaxReturn([
'status' => false,
'msg' => '获取失败',
]);
}
$accessToken = $result['access_token'];
$ticketUrl = 'https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=' . $accessToken . '&type=jsapi';
$result = file_get_contents($ticketUrl);
$result = json_decode($result, true);
if (!$result || $result['errcode'] != 0) {
$this->ajaxReturn([
'status' => false,
'msg' => '获取失败',
]);
}
$ticket = $result['ticket'];
file_put_contents(RUNTIME_PATH . 'Data/wechat_ticket', json_encode(['ticket' => $ticket, 'expired_at' => time() + 3600]));
} }
$ticket = $result['ticket'];
$randStr = 'aaabbbxeclsx'; $randStr = 'aaabbbxeclsx';
$time = time(); $time = time();

@ -235,20 +235,6 @@
<span>游戏类型:<span>{$vo.game_type_name}</span>&nbsp;&nbsp;</span> <span>游戏类型:<span>{$vo.game_type_name}</span>&nbsp;&nbsp;</span>
</p> </p>
</div> </div>
<?php switch ($vo['enable_status']) {
case 1:
$enableStatus = '已打包';
break;
case 2:
$enableStatus = '准备打包';
break;
case 3:
$enableStatus = '打包中';
break;
case -1:
$enableStatus = '打包失败';
break;
}?>
<?php <?php
$qrcode = get_cover($vo['icon'],'path'); $qrcode = get_cover($vo['icon'],'path');
@ -271,9 +257,9 @@
<span class="add-game" game-id="{$vo.id}" promote-type="3" style="cursor: pointer;margin-right: 10px;"><u>添加推广员游戏</u></span> <span class="add-game" game-id="{$vo.id}" promote-type="3" style="cursor: pointer;margin-right: 10px;"><u>添加推广员游戏</u></span>
</if> </if>
<?php $downloadUrl = get_apply_dow_url($vo['id'],$vo['promote_id']);?> <?php $downloadUrl = get_apply_dow_url($vo['id'],$vo['promote_id']);?>
<span class="game-link" data-qrcode="{:U('Apply/qrcode',['url'=>base64_encode(base64_encode($downloadUrl)),'logo'=>$qrcode])}" data-url="{$downloadUrl}" data-status="{$enableStatus}" style="cursor: pointer;margin-right: 10px;"><u>复制下载链接</u></span> <span class="game-link" data-qrcode="{:U('Apply/qrcode',['url'=>base64_encode(base64_encode($downloadUrl)),'logo'=>$qrcode])}" data-url="{$downloadUrl}" data-status="{$vo.enable_status}" style="cursor: pointer;margin-right: 10px;"><u>复制下载链接</u></span>
<?php $flooringPageUrl = 'http://'.C('APPLY_DOWN_DOMAIN').U('Home/promitionofregestion',array('gid'=>$vo['id'],'pid'=>$vo['promote_id']));?> <?php $flooringPageUrl = 'http://'.C('APPLY_DOWN_DOMAIN').U('Home/promitionofregestion',array('gid'=>$vo['id'],'pid'=>$vo['promote_id']));?>
<span class="game-link" data-qrcode="{:U('Apply/qrcode',['url'=>base64_encode(base64_encode($flooringPageUrl)),'logo'=>$qrcode])}" data-url="{$flooringPageUrl}" data-status="{$enableStatus}" style="cursor: pointer;margin-right: 10px;"><u>落地页链接</u></span> <span class="game-link" data-qrcode="{:U('Apply/qrcode',['url'=>base64_encode(base64_encode($flooringPageUrl)),'logo'=>$qrcode])}" data-url="{$flooringPageUrl}" data-status="{$vo.enable_status}" style="cursor: pointer;margin-right: 10px;"><u>落地页链接</u></span>
<span class="down-game-btn" data-id="{$vo.id}" style="cursor: pointer;margin-right: 10px;color: #999"><u>下架</u></span> <span class="down-game-btn" data-id="{$vo.id}" style="cursor: pointer;margin-right: 10px;color: #999"><u>下架</u></span>
</div> </div>
</div> </div>
@ -988,36 +974,30 @@
$('.game-link').on('click', function () { $('.game-link').on('click', function () {
var url = $(this).attr('data-url'); var url = $(this).attr('data-url');
var qrcode = $(this).attr('data-qrcode'); var qrcode = $(this).attr('data-qrcode');
var enableStatus = $(this).attr('data-status'); var enableStatus = parseInt($(this).attr('data-status'));
if (enableStatus != '已打包') { if (enableStatus != 1) {
var iconIndex = 7; var iconIndex = 7;
if (enableStatus == '打包失败') { var enableStatusName = '';
iconIndex = 5;
switch (enableStatus) {
case 0:
enableStatusName = '未打包';
break;
case 2:
case 3:
enableStatusName = '打包中';
break;
case -1:
iconIndex = 5;
enableStatusName = '打包失败';
break;
} }
layer.msg(enableStatus, {icon: iconIndex}); layer.alert(enableStatusName, {icon: iconIndex});
return false; return false;
} }
// $.ajax({
// type: "post",
// url: "__URL__/qrcodeNew",
// dataType: "json",
// data: {'url':url},
// success: function (data) {
// console.log(data);
// },
// error: function (result) {
// layer.msg('网络异常', {icon: 5});
// }
// });
// $.get("__URL__/qrcodeNew/url/" + url,function(data,status){
// console.log(data);
// qrcode = data;
// });
// $('#download_copy').attr('data-url',url); // $('#download_copy').attr('data-url',url);
$('#game_link_ercode').attr('src',qrcode); $('#game_link_ercode').attr('src',qrcode);
$('#game_link_address').text(url); $('#game_link_address').text(url);

@ -2,7 +2,19 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta itemprop="name" content="{$data[0]['relation_game_name']}"/> <meta itemprop="name" content="{$data[0]['relation_game_name']}"/>
<meta itemprop="image" content="https://{$_SERVER['HTTP_HOST']}{$data[0]['icon']|get_cover='path'}"/>
<?php
$icon = get_cover($data[0]['icon'],'path');
if (stripos($icon,'http') === false) {
if (stripos($icon,'.com') === false) {
$icon = 'http://'.C('APPLY_DOWN_DOMAIN').$icon;
} else {
$icon = 'http://'.$icon;
}
}
?>
<meta itemprop="image" content="{$icon}"/>
<meta name="description" itemprop="description" <meta name="description" itemprop="description"
content="{$data[0]['features']}"/> content="{$data[0]['features']}"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
@ -57,7 +69,7 @@
<body class="main_bg"> <body class="main_bg">
<input type="hidden" name="title" value="{$data[0]['relation_game_name']}"> <input type="hidden" name="title" value="{$data[0]['relation_game_name']}">
<input type="hidden" name="icon" value="{$data[0]['icon']|get_cover='path'}"> <input type="hidden" name="icon" value="{$icon}">
<input type="hidden" name="desc" value="{$data[0]['features']}"> <input type="hidden" name="desc" value="{$data[0]['features']}">
<div class="bn-rule" style="display: none;"><img id="rule-img" src=""></div> <div class="bn-rule" style="display: none;"><img id="rule-img" src=""></div>
@ -152,7 +164,8 @@
}) })
var title = $('[name=title]').val(); var title = $('[name=title]').val();
var description = $('[name=desc]').val(); var description = $('[name=desc]').val();
var icon = window.location.protocol + "//" + window.location.host + $('[name=icon]').val(); // var icon = window.location.protocol + "//" + window.location.host + $('[name=icon]').val();
var icon = $('[name=icon]').val();
wxReady(title, description, icon) wxReady(title, description, icon)
} }
} }

Loading…
Cancel
Save