Authored by yangyang

元旦领券3

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<title>{{staticTitle}}</title>
<meta name="apple-mobile-web-app-title" content="SUMMER SALE">
<meta name="format-detection" content="telephone=no">
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no,minimal-ui"
media="(device-height: 568px)">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="grey">
<link rel="stylesheet" href="{{imgUrl}}/cuxiao/css/newyear/index3.css">
<script>
(function(doc, win) {
var docEl = doc.documentElement;
(function() {
var clientWidth = docEl.clientWidth;
if (!clientWidth) {
return;
}
docEl.style.fontSize = 20 * (clientWidth / 320) + 'px';
}());
})(document, window);
</script>
</head>
<body class="keBody">
<div class="coupon-christmas" show="{{showPopupFlag}}">
<div class="coupon-top">
<img src="{{imgUrl}}/cuxiao/img/newyear/top-bg.png" alt="">
<a class="go-check" href="{{myCouponUrl}}"></a>
<a class="share-btn" href="javascript:;"></a>
</div>
<div class="coupon-bottom">
<div class="coupon-banner">
<a href="{{bannerUrl_1}}">
<img src="{{imgUrl}}/cuxiao/img/newyear/banner01.png" alt="">
</a>
<a href="{{bannerUrl_2}}">
<img src="{{imgUrl}}/cuxiao/img/newyear/banner02.png" alt="">
</a>
<a href="{{bannerUrl_3}}">
<img src="{{imgUrl}}/cuxiao/img/newyear/banner03.png" alt="">
</a>
<a href="{{bannerUrl_4}}">
<img src="{{imgUrl}}/cuxiao/img/newyear/banner04.png" alt="">
</a>
</div>
<div class="bottom-btn">
<a class="follow-yoho" href="http://mp.weixin.qq.com/s?__biz=MjM5ODI5MDA4MA==&amp;mid=201849402&amp;idx=1&amp;sn=c0089812f9769d82e0075f69d771f6e1#rd"></a>
<a class="download-yoho" href="http://a.app.qq.com/o/simple.jsp?pkgname=com.yoho&amp;g_f=995445"></a>
</div>
</div>
<div class="coupon-ft">
<img src="{{imgUrl}}/cuxiao/img/newyear/14.png">
</div>
</div>
<div class="modal"></div>
<div class="dialog-box geted">
<div class="dialog-inner">
<img src="{{imgUrl}}/cuxiao/img/newyear/geted.png" alt=""/>
<span class="dialog-close"></span>
</div>
</div>
<div class="dialog-box fail">
<div class="dialog-inner">
<img src="{{imgUrl}}/cuxiao/img/newyear/fail.png" alt=""/>
<span class="refresh-btn"></span>
</div>
</div>
<input id="shareLink" type="hidden" value="{{shareLink}}">
<input id="shareImg" type="hidden" value="{{shareImg}}">
<input id="shareTitle" type="hidden" value="{{shareTitle}}">
<input id="shareDesc" type="hidden" value="{{shareDesc}}">
<script type="text/javascript" src="{{imgUrl}}/cuxiao/js/jquery.min.js"></script>
<script>
//提示分享
$('.share-btn').click(function () {
$('.modal').fadeIn();
});
//关闭提示分享
$('.modal').click(function () {
$(this).fadeOut();
});
//提示已领过券
if ($('.coupon-christmas').attr('show') === '1') {
$('.dialog-box.geted').show();
}
//提示领券失败
else if ($('.coupon-christmas').attr('show') === '2') {
$('.dialog-box.fail').show();
}
//关闭提示
$('.dialog-close').click(function(){
$(this).parents('.dialog-box').fadeOut();
});
//刷新页面
$('.refresh-btn').click(function() {
location.reload();
})
</script>
</body>
</html>
\ No newline at end of file
... ...
... ... @@ -110,7 +110,59 @@ class ChristmasController extends HuodongAction
'bannerUrl_4' => 'http://feature.yoho.cn/1221/1221APPHOMEKIDS/index.html?openby:yohobuy={"action":"go.h5","params":{"title":"潮集圣诞","url":"http://feature.yoho.cn/1221/1221APPHOMEKIDS/index.html?","share":"\/operations\/api\/v5\/webshare\/getShare","shareparam":{"share_id":"534"},"param":{"share_id":"534"}}}',
));
}
/**
* 元旦领券(圣诞领券第三波)
* 备注:2015年12月25号测试
*/
public function newyear3Action()
{
//获取登录者ID,未登录返回false
$uid = $this->getLoggedUid();
if (!$uid || !is_numeric($uid)) {
//未登录的用户访问,跳转到登录页面。并且在登陆后跳转回本页面
$this->go(Helpers::url('/signin.html', array('refer' => Helpers::url('/cuxiao/christmas/christmas2')), 'default'));
}
// 该变量用来控制和显示页面的弹出提示
$showPopupFlag = '0';
//获取跳转到个人中心-我的优惠券链接,并调用接口,完成领券操作
$myCouponUrl = Helpers::url('/home/coupons', null, 'default') . '?openby:yohobuy={"action":"go.coupon"}';
$activityId = $this->getActivityId3();
$result = ActivityData::getCouponAll($uid, $activityId);
if (isset($result['code'])) {
switch (intval($result['code'])) {
case 200: // 领取成功, 发送站内信消息
$showPopupFlag = '0';
$this->sendMessage($uid, '【优惠券】您获得500元元旦优惠券', '尊敬的客户:恭喜您成功获得500元套券 !您可以在个人中心的交易管理中查看‘我的优惠券’。');
break;
case 201: // 已领取过, 提示重复领券
$showPopupFlag = '1';
break;
default: // 领取失败, 提示领券失败
$showPopupFlag = '2';
break;
}
}
$this->_view->display('index-3', array(
'staticTitle' => '年终热促',
'weixinShare' => $this->_isApp ? false : true, // 是否需要微信分享
'shareLink' => 'http://feature.yohobuy.com/0/0/724/index.html',
'shareTitle' => 'YOHO!BUY有货【Final Sale】年终热促开启,限时4.8折封顶!',
'shareDesc' => '500元优惠券限时派送,更有800+潮牌跨年礼物赠不停!',
'shareImg' => 'http://img11.static.yhbimg.com/couponImg/2015/12/25/07/010657d070da271499ad9367c5806486b2.png',
'showPopupFlag' => $showPopupFlag,
'myCouponUrl' => $myCouponUrl,
'bannerUrl_1' => 'http://feature.yoho.cn/1228/1228APPHOMEBOY/index.html?openby:yohobuy={"action":"go.h5","params":{"title":"Final sale","url":"http://feature.yoho.cn/1228/1228APPHOMEBOY/index.html?","share":"\/operations\/api\/v5\/webshare\/getShare","shareparam":{"share_id":"360"},param":{"share_id":"360"}}}',
'bannerUrl_2' => 'http://feature.yoho.cn/1228/1228APPHOMEGIRL/index.html?openby:yohobuy={"action":"go.h5","params":{"title":"Final sale","url":"http://feature.yoho.cn/1228/1228APPHOMEGIRL/index.html?","share":"\/operations\/api\/v5\/webshare\/getShare","shareparam":{"share_id":"358"},param":{"share_id":"358"}}}',
'bannerUrl_3' => 'http://feature.yoho.cn/1228/1228APPHOMEKIDS/index.html?openby:yohobuy={"action":"go.h5","params":{"title":"Final sale","url":"http://feature.yoho.cn/1228/1228APPHOMEKIDS/index.html?","share":"\/operations\/api\/v5\/webshare\/getShare","shareparam":{"share_id":"356"},param":{"share_id":"356"}}}',
'bannerUrl_4' => 'http://feature.yoho.cn/1228/1228APPHOMELIFE/index.html?openby:yohobuy={"action":"go.h5","params":{"title":"Final sale","url":"http://feature.yoho.cn/1228/1228APPHOMELIFE/index.html?","share":"\/operations\/api\/v5\/webshare\/getShare","shareparam":{"share_id":"354"},param":{"share_id":"354"}}}
',
));
}
/**
* 检测登录状态
*
... ... @@ -182,4 +234,22 @@ class ChristmasController extends HuodongAction
}
}
/**
* 根据环境来获取活动ID
*
* @return int
*/
private function getActivityId3()
{
// 设置环境变量
switch (APPLICATION_ENV) {
case 'production': // 生产
return 390;
case 'preview': // 预览
case 'testing': // 测试
case 'develop': // 开发
default:
return 85;
}
}
}
... ...