添加tf礼包问题

master
ELF 5 years ago
parent 0de3a96ff2
commit 2a2e5f0d31

@ -102,9 +102,6 @@ class GiftbagController extends ThinkController {
public function add(){
if(IS_POST){
if ($_POST['giftbag_version'] == '3') {
$whereGift['giftbag_version'] = $_POST['giftbag_version'];
$whereGift['game_id'] = $_POST['game_id'];

@ -90,6 +90,9 @@
<label id="type3">
<input type="radio" class="inp_radio js-typeradio" value="3" name="giftbag_version" > <span class="type3">超级签</span>
</label>
<label id="type4">
<input type="radio" class="inp_radio js-typeradio" value="4" name="giftbag_version" > <span class="type4">TF落地页礼包</span>
</label>
</span>
<input type="hidden" id="giftbag_version" name="giftbag_version" value="">

@ -89,6 +89,9 @@
<label id="type3">
<input type="radio" class="inp_radio js-typeradio" value="3" name="giftbag_version" disabled="true"> <span class="type3" >超级签</span>
</label>
<label id="type4">
<input type="radio" class="inp_radio js-typeradio" value="4" name="giftbag_version" disabled="true"> <span class="type4">TF落地页礼包</span>
</label>
</span>
<input type="hidden" id="giftbag_version" name="giftbag_version" value="{$data.giftbag_version}">
</td>

@ -144,7 +144,10 @@
<td ><input class="ids" type="checkbox" value="{$data['id']}" name="ids[]"></td>
<td>{$data.game_name}</td>
<td>{$data.giftbag_name}</td>
<td >{:get_systems_name($data['giftbag_version'])}<if condition="$data.giftbag_version eq 3">超级签<elseif condition="$data.giftbag_version eq 0"/>全部</if></td>
<td >
{:get_systems_name($data['giftbag_version'])}
<if condition="$data.giftbag_version eq 3">超级签<elseif condition="$data.giftbag_version eq 4"/>TF落地页礼包<elseif condition="$data.giftbag_version eq 0"/>全部</if>
</td>
<td>{$data['novice_num']}</td>
<td>{$data['novice']}</td>
<td>

@ -16,6 +16,7 @@
<link rel="stylesheet" type="text/css" href="__CSS__/swiper.min.css">
<link rel="stylesheet" type="text/css" href="__CSS__/reset.css">
<link rel="stylesheet" type="text/css" href="__CSS__/index2.css">
<link rel="stylesheet" type="text/css" href="__CSS__/giftbag.css">
<title>{$game['relation_game_name']}</title>
</head>
<body onclick="checkSafari()">
@ -104,7 +105,10 @@
<div>{$game['features']}</div>
<div>
<div class="download" data-downloadable="<?= ($game['dow_status'] != 1 || $game['download_ways'] == 0) ? 0 : 1 ?>">免费安装</div>
<img src="__IMG__/wenhao.png" class="doubt" alt="">
<div style="display: flex;align-items: center;">
<img src="__IMG__/libao.png" style="width: 0.6rem;height: 0.6rem;margin-right:0.15rem;" class="giftBag" alt="">
<img src="__IMG__/wenhao.png" style="width: 0.6rem; height: 0.6rem;" class="doubt" alt="">
</div>
</div>
</div>
</div>
@ -341,6 +345,75 @@
</div>
</div>
<!-- 礼包 -->
<div class="giftBag_mode">
<div class="">
<img src="__IMG__/libao2.png" class="img1" alt="">
<img src="__IMG__/lingqu.png" class="img2" alt="">
</div>
</div>
<div class="getGift giftStep" style="display: none;">
<div class="getGift-heard">
领取礼包
<a href="#"></a>
</div>
<div class="getGiftNot" style="display: none;">
<div class="getGiftNot-img">
<img src="__IMG__/wu.png" alt="">
<div>暂无礼包</div>
</div>
<!-- <div class="btn">返回</div> -->
</div>
<div class="getGift-box">
<div class="getGift-game">
<img src="{$game['icon']}" alt="">
<div class="game-right">
<div class="title">{$game['relation_game_name']}</div>
<div class="number">礼包总数 <span class="giftbag-count">0</span></div>
</div>
</div>
<div class="getGift-info">
</div>
</div>
</div>
<div class="getGift giftSecond" style="display: none;">
<div class="getGift-heard">
领取礼包
<a href="#"></a>
</div>
<!-- 无礼包时显示 -->
<div class="getGift-box">
<div class="getGift-second">
<div class="getGift-bag">
<div class="second-left">
<div class="title" class="giftbag-name"></div>
<div class="number">剩余 <span class="novice-count"></span></div>
</div>
<div class="btn get-novice" data-gift-id="">领取</div>
</div>
<div class="getGift-activation" style="display: none;">
<div class="code">激活码:<span class="novice-value"> </span> </div>
<div class="copy">复制</div>
</div>
</div>
<div class="getGift-secondInfo">
<div class="infoBox">
<div class="title">有效期</div>
<div class="del useful-date"></div>
</div>
<div class="infoBox">
<div class="title">礼包内容</div>
<div class="del desribe"></div>
</div>
<div class="infoBox">
<div class="title">使用说明</div>
<div class="del digest"></div>
</div>
</div>
</div>
</div>
<!-- 登录 -->
<div id="login-box" class="register login" style="display: none;">
<div class="register-box">
@ -568,7 +641,6 @@ background:rgba(0,0,0,0.6); z-index: 999;display: none;"></div>
var curUserId = 0;
var gameId = parseInt("{$game.id}");
var promoteId = parseInt("{$promoteId}");
console.log(promoteId)
var betaUrl = "{$game['beta_url']}";
curUserId = Cookies.get('landing_login_user') == undefined ? 0 : Cookies.get('landing_login_user');
var isLogin = (curUserId == 0 ? false : true);
@ -712,6 +784,8 @@ var PhoneObj = {
$(".second").hide();
$(".register").hide();
$(".mode").hide();
$(".giftSecond").hide()
$(".giftStep").hide()
})
$(".commonCut").click(function(){
$(".commonWindow").hide();
@ -1367,7 +1441,186 @@ var PhoneObj = {
});
});
}
</script>
// <script src="__STATIC__/clipboard.min.js"></script>
<script type="text/javascript" src="http://www.jq22.com/demo/clipboard.js-master201703170013/dist/clipboard.min.js"></script>
<script>
$(function(){
var curUserId = 0;
curUserId = Cookies.get('landing_login_user') == undefined ? 0 : Cookies.get('landing_login_user');
var isLogin = (curUserId == 0 ? false : true);
var gameId = parseInt("{$game.id}");
var giftbags = []
$(".giftBag_mode").click(function(){
$(this).hide()
document.body.style.overflow = 'auto';
});
$(".giftBag").click(function(){
getGiftbags(gameId)
$(".giftStep").show();
document.body.style.overflow = 'hidden';
$('.mode').show();
});
</script>
$(".giftSecond .getGift-heard>a").click(function(){
$(".giftSecond").hide()
$(".giftStep").show()
});
$(".giftStep .getGift-heard>a").click(function(){
$(".giftSecond").hide()
$(".giftStep").hide()
$('.mode').hide()
document.body.style.overflow = 'auto';
});
$(".getGift-info").on('click', '.show-giftbag', function() {
/* $(this).html('已领取');
$(this).css({
"background":"rgba(242,242,244,1)",
"color":"rgba(169,169,169,1)",
"border": "0"
}); */
var giftId = $(this).parents('.getGift-infoBox').eq(0).attr('data-id')
for (var key in giftbags) {
if (giftbags[key].id == giftId) {
if (giftbags[key].get_status == 1) {
$('.giftSecond .getGift-box').find('.get-novice').html('已领取')
$('.giftSecond .getGift-box').find('.get-novice').addClass('has-get')
} else {
$('.giftSecond .getGift-box').find('.get-novice').html('领取')
$('.giftSecond .getGift-box').find('.get-novice').removeClass('has-get')
}
$('.giftSecond .getGift-box').find('.get-novice').attr('data-gift-id', giftbags[key].id)
$('.giftSecond .getGift-box').find('.giftbag-name').html(giftbags[key].giftbag_name)
$('.giftSecond .getGift-box').find('.novice-count').html(giftbags[key].novice_num)
// $('.giftSecond .getGift-box').find('.novice-value').html()
$('.giftSecond .getGift-box').find('.useful-date').html(giftbags[key].useful_date)
$('.giftSecond .getGift-box').find('.desribe').html(giftbags[key].desribe)
$('.giftSecond .getGift-box').find('.digest').html(giftbags[key].digest)
break;
}
}
$(".giftStep").hide();
$(".giftSecond").show();
})
/* $(".getGift-infoBox .btn").click(function(){
$(this).html('已领取');
$(this).css({
"background":"rgba(242,242,244,1)",
"color":"rgba(169,169,169,1)",
"border": "0"
});
$(".giftStep").hide();
$(".giftSecond").show();
}); */
$(".getGift-second .btn").click(function() {
if ($(this).hasClass('has-get')) {
return layer.msg('您已经领取过该礼包');
}
if (!isLogin) {
layer.msg('请先登录');
goLogin()
return
}
var giftId = $(this).attr('data-gift-id')
var novice = getNovice(giftId)
if (novice !== '') {
$('.giftSecond .getGift-box').find('.novice-value').html(novice)
$(this).addClass('.has-get')
$(".getGift-activation").show();
$(".getGift-second").css({"height" : "1.26rem"});
$(".getGift-secondInfo").css({"height" : "1.93rem"})
}
});
// 复制
$(".copy").click(function(){
var qrcodeLink = $(".code>span").html()
var clipboard = new Clipboard('.copy', {
text: function() {
return qrcodeLink;
}
});
clipboard.on('success', function(e) {
$(".copy").html('已复制')
});
clipboard.on('error', function(e) {
$(".copy").html('未复制')
});
})
function getGiftbags(gameId) {
$.ajax({
url: '/mobile.php?s=/Gift/getTFGiftbags.html',
data: { game_id: gameId },
dataType: 'json',
type: 'post',
success: function(response) {
if (response.status) {
giftbags = response.data.records
if (giftbags.length == 0) {
$('.giftStep .getGiftNot').show()
$('.giftStep .getGift-box').hide()
return
}
$('.giftbag-count').html(giftbags.length)
var html = ''
for (var key in giftbags) {
var item = giftbags[key];
var btnHtml = '<div class="btn show-giftbag">去领取</div>'
if (item.get_status == 1) {
btnHtml = '<div class="btn has-get show-giftbag">已领取</div>'
}
html += '<div class="getGift-infoBox" data-id="' + item.id + '">'
+ '<div class="info-left">'
+ '<div class="title">' + item.giftbag_name + '</div>'
+ '<div class="del desc">' + item.desribe + '</div>'
+ '</div>'
+ btnHtml
+ '</div>';
}
$('.getGift-info').html(html)
$('.giftStep .getGiftNot').hide()
$('.giftStep .getGift-box').show()
} else {
layer.msg(response.message);
}
}
})
}
function goLogin() {
$(".commonWindow").hide();
$(".giftStep").hide();
$(".giftSecond").hide();
$(".login").show();
}
function getNovice(giftId) {
var novice = ''
$.ajax({
url: '/mobile.php?s=/Gift/getNovice.html',
data: { gift_id: giftId},
dataType: 'json',
async: false,
type: 'post',
success: function(response) {
if (response.status) {
layer.msg(response.message);
novice = response.data.novice
} else {
if (response.code == '1001') {
goLogin()
}
layer.msg(response.message);
}
}
})
return novice
}
})
</script>

@ -2,6 +2,7 @@
namespace Mobile\Controller;
use Org\Ipa365SDK\Ipa365;
use User\Api\MemberApi;
use User\Api\SuserApi;
use Think\Log;
use Base\Service\ApplyService;
use Base\Tool\TaskClient;
@ -60,8 +61,8 @@ class CommonController extends BaseController {
$promote = M('promote', 'tab_')->where(['id' => $promoteId])->find();
$userApi = new MemberApi();
$userId = $userApi->login($account, $password, 1); //调用登录
$suserApi = new SuserApi();
$userId = $suserApi->login($account, $password, 1); //调用登录
$resMsg = "登录成功";
if ($userId <= 0) {
switch ($userId) {
@ -136,8 +137,8 @@ class CommonController extends BaseController {
}
//添加自动登录
$userApi = new MemberApi();
$userId = $userApi->login($params['account'], $params['password'], 1);
$suserApi = new SuserApi();
$userId = $suserApi->login($params['account'], $params['password'], 1);
$_SESSION['user_id'] = $userId;
$this->setData(['user_id' => $userId])->respondSuccess('添加成功');
}
@ -182,8 +183,8 @@ class CommonController extends BaseController {
}
//添加自动登录
$userApi = new MemberApi();
$userId = $userApi->login($account, $password, 1);
$suserApi = new SuserApi();
$userId = $suserApi->login($account, $password, 1);
$_SESSION['user_id'] = $userId;
$this->setData(['user_id' => $userId])->respondSuccess('注册成功');
}

@ -258,4 +258,76 @@ class GiftController extends BaseController {
$this->success("领取成功",$novice);
}
public function getTFGiftbags() {
$game_id = I('post.game_id');
$status = 0;
$row = C('LIST_ROWS');
$map['status'] = 1;
$time = NOW_TIME;
$map['game_id'] = $game_id;
$map['giftbag_version'] = 4;
$map['novice'] = array('neq','');
//$map['start_time'] = ['elt',$time];
$map['_string'] = "end_time > {$time} or end_time = 0";
$lists = D('Giftbag')
->field("tab_giftbag.*,g.icon,g.relation_game_name")
->join("left join tab_game g on g.id = tab_giftbag.game_id and g.game_status=1 and g.display_site like '%". DISPLAY_SITE ."%' ")
->where($map)
->select();
$existRecords = [];
if (count($lists) > 0 && $this->islogin()) {
$member = new SuserApi;
$logininfo = $member->login_info();
$conditions = [];
$conditions['user_id'] = $logininfo['user_id'];
$conditions['gift_id'] = ['in', array_column($lists, 'id')];
$existRecords = M("gift_record",'tab_')->field(['id', 'gift_id'])->where($conditions)->select();
$existRecords = index_by_column('gift_id', $existRecords);
}
$records = [];
foreach ($lists as $key => $val){
$novices = str2arr($val['novice'],',');
$noviceNum = count(array_filter($novices));
if (isset($existRecords[$val['id']])) {
$getStatus = 1;
} else {
$getStatus = 0;
}
$records[$key]['id'] = $val['id'];
$records[$key]['desribe'] = $val['desribe'];
$records[$key]['giftbag_name'] = $val['giftbag_name'];
$records[$key]['digest'] = $val['digest'];
$records[$key]['get_status'] = $getStatus;
$records[$key]['novice_num'] = $noviceNum;
$records[$key]['game_icon'] = get_cover($val['icon'],'path');
$records[$key]['game_name'] = $val['giftbag_name'];
$records[$key]['useful_date'] = set_show_time($val['start_time'],'date') . ' 至 '. set_show_time($val['end_time'],'date','forever');
}
echo json_encode(['status' => true, 'message' => '获取成功', 'data' => ['records' => $records]]);
}
public function getNovice($gift_id){
if(!$this->islogin()) {
echo json_encode(['status' => false, 'code' => '1001', 'message' => '请先登录']); exit();
}
$giftId = I('post.gift_id');
$member = new SuserApi;
$logininfo = $member->login_info();
$model = D("Giftbag");
$exist = $model->checkAccountGiftExist($logininfo['user_id'], $giftId);
if($exist){
echo json_encode(['status' => false, 'code' => '1000', 'message' => '您已经领取过该礼包!']); exit();
}
$novice = $model->getNovice($logininfo['user_id'], $logininfo['account'], $giftId);
if(empty($novice)){
echo json_encode(['status' => false, 'code' => '1000', 'message' => '暂无激活码']); exit();
}
echo json_encode(['status' => true, 'code' => '0000', 'message' => '领取成功', 'data' => ['novice' => $novice]]); exit();
}
}

@ -237,6 +237,10 @@ class GiftbagModel extends Model{
$record['game_name'] = $data['game_name'];//get_game_name($data['game_id']);
$record['gift_id'] = $gift_id;
$record['gift_name'] = $data['giftbag_name'];
$record['server_id'] = $data['server_id'];
$record['server_name'] = $data['server_name'];
$record['status'] = 0;
$record['novice'] = $novice;
$record['user_id'] = $user_id;

@ -0,0 +1,283 @@
body{
overflow: hidden;
}
.mode{
position: fixed;
width: 100%;
height: 100%;
background-color: rgba(0,0,0,0.4);
top: 0;
left: 0;
font-size: 0.2rem;
}
.giftBag_mode{
position: fixed;
width: 100%;
height: 100%;
background-color: rgba(0,0,0,0.4);
top: 0;
left: 0;
font-size: 0.2rem;
}
.giftBag_mode>div{
display: flex;
flex-direction: column;
align-items: flex-end;
justify-content: flex-end;
padding-top: 6.47rem;
margin-right: 0.97rem;
font-size: 0.2rem;
}
.giftBag_mode>div>.img1{
width: 0.82rem;
height: 0.82rem;
}
.giftBag_mode>div>.img2{
width: 2.97rem;
height: 0.52rem;
}
.getGift{
position: fixed;
width: 5.5rem;
height: 4rem;
top: 50%;
margin-top: -2rem;
left: 50%;
margin-left: -2.75rem;
background-color: #fff;
border-radius: 0.3rem;
z-index: 1000;
}
.getGift-heard{
height: 0.8rem;
width: 100%;
text-align: center;
line-height: 0.8rem;
background-color: #489EF6;
font-size: 0.28rem;
color: #fff;
font-weight: 500;
border-top-left-radius: 0.3rem;
border-top-right-radius: 0.3rem;
position: relative;
border-top-left-radius:0.3rem;
border-top-right-radius:0.3rem;
}
.getGift-heard>a{
position: absolute;
left: 0.4rem;
top: 50%;
margin-top: -0.15rem;
width: 0.17rem;
height: 0.3rem;
background: url("../images/20191225/fanhui.png");
background-size: 100% 100%;
}
.getGift-box{
padding: 0 0.3rem;
border-bottom-right-radius: 0.3rem;
border-bottom-left-radius: 0.3rem;
}
.getGift-game{
width: 100%;
display: flex;
align-items: center;
height: 1.03rem;
border-bottom: 1px solid #E4E4E4;
}
.getGift-game>img{
width: 0.6rem;
height: 0.6rem;
margin-right: 0.2rem;
}
.getGift-game>div{
display: flex;
align-items: flex-start;
justify-content: center;
flex-direction: column;
}
.getGift-game>div .title{
font-size:0.24rem;
font-family:PingFang SC;
font-weight:500;
color:rgba(41,41,41,1);
}
.getGift-game>div .number{
font-size:0.16rem;
font-family:PingFang SC;
font-weight:400;
color:rgba(169,169,169,1);
}
.getGift-info{
height: 2.16rem;
overflow-y: auto;
}
.getGift-infoBox{
display: flex;
align-items: center;
justify-content: space-between;
height: 0.9rem;
border-bottom: 1px solid #E4E4E4;
}
.getGift-infoBox:last-child{
border: 0;
}
.getGift-infoBox .info-left{
display: flex;
flex-direction: column;
align-items: flex-start;
}
.getGift-infoBox .info-left .title{
font-size:0.2rem;
font-family:PingFang SC;
font-weight:500;
color:rgba(41,41,41,1);
}
.getGift-infoBox .info-left .del{
width: 2.91rem;
font-size:0.16rem;
font-family:PingFang SC;
font-weight:400;
color:rgba(169,169,169,1);
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap;
}
.getGift-infoBox .btn,.getGift-second .btn{
width:1rem;
height:0.4rem;
background:rgba(169,169,169,0);
border:1px solid rgba(33, 177, 235, 1);
border-radius:0.16rem;
font-size:0.2rem;
font-family:PingFang SC;
font-weight:400;
color:rgba(33,177,235,1);
text-align: center;
line-height: 0.4rem;
}
.getGift-second{
height: 0.86rem;
display: flex;
flex-direction: column;
justify-content: center;
border-bottom: 1px solid #E4E4E4;
}
.getGift-bag{
display: flex;
align-items: center;
justify-content: space-between;
}
.getGift-second .second-left{
display: flex;
flex-direction: column;
align-items: flex-start;
}
.getGift-second .second-left .title{
font-size:0.24rem;
font-family:PingFang SC;
font-weight:500;
color:rgba(41,41,41,1);
}
.getGift-second .second-left .number{
font-size:0.16rem;
font-family:PingFang SC;
font-weight:400;
color:rgba(169,169,169,1);
}
.getGift-second .second-left .number>span{
color: #262626;
}
.getGift-activation{
display: flex;
align-items: center;
margin-top: 0.12rem;
}
.getGift-activation .code{
width:3.9rem;
height:0.3rem;
background:rgba(242,242,244,1);
border-radius:0.1rem;
font-size:0.16rem;
font-family:PingFang SC;
font-weight:400;
color:rgba(169,169,169,1);
text-align: center;
line-height: 0.3rem;
}
.getGift-activation .copy{
width:1rem;
height:0.4rem;
background:rgba(33,177,235,1);
border-radius:0.1rem;
font-size:0.16rem;
font-family:PingFang SC;
font-weight:400;
color:rgba(254,254,254,1);
text-align: center;
line-height: 0.4rem;
margin-left: 0.2rem;
}
.getGift-secondInfo{
height: 2.33rem;
overflow-y: auto;
}
.getGift-secondInfo .infoBox{
display: flex;
flex-direction: column;
align-items: flex-start;
margin-top: 0.23rem;
}
.getGift-secondInfo .infoBox .title{
font-size:0.2rem;
font-family:PingFang SC;
font-weight:400;
color:rgba(41,41,41,1);
}
.getGift-secondInfo .infoBox .del{
width: 100%;
font-size:0.16rem;
font-family:PingFang SC;
font-weight:400;
color:rgba(169,169,169,1);
margin-top: 0.1rem;
}
.getGiftNot{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 3.2rem;
}
.getGiftNot-img{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size:0.2rem;
font-family:PingFang SC;
font-weight:500;
color:rgba(41,41,41,1);
}
.getGiftNot-img>img{
width: 2.06rem;
height: 1.58rem;
}
.getGiftNot>.btn{
width:1.2rem;
height:0.4rem;
background:rgba(34,129,245,1);
border-radius:0.2rem;
font-size:0.24rem;
font-family:PingFang SC;
font-weight:400;
color:rgba(255,255,255,1);
text-align: center;
line-height: 0.4rem;
margin-top: 0.32rem;
}
.getGift-box .btn.has-get {
background:rgba(242,242,244,1);
color:rgba(169,169,169,1);
border:0
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Loading…
Cancel
Save