Authored by hf

Merge branch 'gamecoupon'

* {
margin: 0;
padding: 0;
}
.coupon-container img {
display: block;
max-width: 100%;
}
.coupon-top {
position: relative;
}
.coupon-top .go-check {
position: absolute;
bottom: 7.075rem;
width: 100%;
height: 3.0rem;
}
.coupon-top .app-btn {
position: absolute;
width: 7.55rem;
height: 4.0rem;
bottom: 1.6rem;
}
.coupon-top .app-btn.app1{
left: 0.325rem
}
.coupon-top .app-btn.app2{
right: 0.325rem
}
.coupon-bottom {
height: 24.125rem;
background: url(../../img/newyear/160105/bottom-bg.png) no-repeat bottom center;
background-size: 100% 100%;
}
.coupon-banner {
text-align: center;
font-size: 0;
}
.coupon-banner a {
display: inline-block;
width: 6.6rem;
height: 6.6rem;
margin: 0 0.25rem 0.55rem;
}
.coupon-bottom .follow-yoho {
display: block;
margin: 1.5rem auto 0;
width: 10.175rem;
height: 2.675rem;
}
.bottom-btn {
margin: 1.95rem 0 0;
font-size: 0;
text-align: center;
}
.bottom-btn a {
display: inline-block;
margin: 0 1.25rem;
width: 5.225rem;
height: 2.0rem;
}
.modal {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: url(../../img/newyear/160105/share.png) center top no-repeat;
-webkit-background-size: 100%;
-moz-background-size: 100%;
background-size: 100%;
display: none;
}
.has-done {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: rgba(0,0,0,0.4) url(../../img/newyear/160105/11.png);
background-repeat: no-repeat;
background-size: 80% auto;
background-position: center center;
overflow: hidden;
display: none;
}
.dialog-box {
display: none;
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: rgba(0,0,0,0.4);
z-index: 999;
}
.dialog-inner {
position: absolute;
width: 13.375rem;
height: 9.625rem;
top: 50%;
left: 50%;
margin: -4.8125rem 0 0 -6.6875rem;
}
.dialog-inner img {
max-width: 100%;
}
.dialog-inner span {
position: absolute;
width: 9rem;
height: 1.85rem;
bottom: 0.6rem;
left: 50%;
margin: 0 0 0 -4.5rem;
cursor: pointer;
}
\ No newline at end of file
... ...
<!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/index-2.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-container" show="{{showPopupFlag}}">
<div class="coupon-top">
<img src="{{imgUrl}}/cuxiao/img/newyear/160105/top-bg.png" alt="">
<a class="go-check" href="{{myCouponUrl}}"></a>
<a class="app-btn app1" href="http://a.app.qq.com/o/simple.jsp?pkgname=com.yoho&g_f=995445"></a>
<a class="app-btn app2" href="http://www.yohoshow.com/about/index/yohobuyqr"></a>
</div>
<div class="coupon-bottom">
<div class="coupon-banner">
<a href="{{bannerUrl_1}}"></a>
<a href="{{bannerUrl_2}}"></a>
<a href="{{bannerUrl_3}}"></a>
<a href="{{bannerUrl_4}}"></a>
</div>
<a class="follow-yoho" href="http://mp.weixin.qq.com/s?__biz=MjM5ODI5MDA4MA==&amp;mid=201849402&amp;idx=1&amp;sn=c0089812f9769d82e0075f69d771f6e1#rd"></a>
<div class="bottom-btn">
<a class="play-again" href="{{playAgain}}"></a>
<a class="share-btn" href="javascript:;"></a>
</div>
</div>
<div class="coupon-ft">
<img src="{{imgUrl}}/cuxiao/img/newyear/160105/14.png">
</div>
</div>
<div class="modal"></div>
<div class="dialog-box geted">
<div class="dialog-inner">
<img src="{{imgUrl}}/cuxiao/img/newyear/160105/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/160105/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-container').attr('show') === '1') {
$('.dialog-box.geted').show();
}
//提示领券失败
else if ($('.coupon-container').attr('show') === '2') {
$('.dialog-box.fail').show();
}
//关闭提示
$('.dialog-close').click(function(){
$(this).parents('.dialog-box').fadeOut();
});
//刷新页面
$('.refresh-btn').click(function() {
location.reload();
});
</script>
{{#if weixinShare}}
<script type="text/javascript" charset="utf-8" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script type="text/javascript" charset="utf-8" src="{{jsUrl}}/cuxiao/js/share.weixin.js"></script>
{{/if}}
{{> layout/analysis}}
</body>
</html>
\ No newline at end of file
... ...
<?php
use Action\HuodongAction;
use LibModels\Wap\Cuxiao\ActivityData;
use Plugin\Helpers;
/**
*
* @name Newyear
* @package
* @copyright yoho.inc
* @version 1.0 (2015-12-30 20:39:50)
* @author fei.hong <fei.hong@yoho.cn>
*/
class NewyearController extends HuodongAction
{
/**
* 利是封领券
*
* 备注:2016年1月5号上线
*/
public function couponAction()
{
//获取登录者ID,未登录返回false
$uid = $this->getLoggedUid();
if (!$uid || !is_numeric($uid)) {
//未登录的用户访问,跳转到登录页面。并且在登陆后跳转回本页面
$this->go(Helpers::url('/signin.html', array('refer' => Helpers::url('/cuxiao/newyear/coupon')), 'default'));
}
// 该变量用来控制和显示页面的弹出提示
$showPopupFlag = '0';
//获取跳转到个人中心-我的优惠券链接,并调用接口,完成领券操作
$myCouponUrl = Helpers::url('/home/coupons', null, 'default') . '?openby:yohobuy={"action":"go.coupon"}';
$activityId = $this->getActivityId();
$result = ActivityData::getCouponAll($uid, $activityId);
if (isset($result['code'])) {
switch (intval($result['code'])) {
case 200: // 领取成功, 发送站内信消息
$showPopupFlag = '0';
$this->sendMessage($uid, '【优惠券】您有1000元套券', '尊敬的客户:恭喜您成功获得1000元套券 !您可以在个人中心的交易管理中查看‘我的优惠券’。');
break;
case 201: // 已领取过, 提示重复领券
$showPopupFlag = '1';
break;
default: // 领取失败, 提示领券失败
$showPopupFlag = '2';
break;
}
}
$this->_view->display('coupon', array(
'staticTitle' => 'YOHO!BUY有货新年寻宝大作战',
'weixinShare' => $this->_isApp ? false : true, // 是否需要微信分享
'shareLink' => 'http://feature.yoho.cn/2016lishifeng/index.html',
'shareTitle' => 'YOHO!BUY有货新年寻宝大作战,千元利是等你赢!',
'shareDesc' => 'YOHO!BUY有货,全球800+潮流品牌每日上新!',
'shareImg' => 'http://img12.static.yhbimg.com/couponImg/2015/12/30/12/02008a9724b898dee56852de9f1a3978bf.jpg',
'showPopupFlag' => $showPopupFlag,
'myCouponUrl' => $myCouponUrl,
'bannerUrl_1' => 'http://m.yohobuy.com/boys?openby:yohobuy={"action":"go.home","params":{"channel":"1"}}',
'bannerUrl_2' => 'http://m.yohobuy.com/girls?openby:yohobuy={"action":"go.home","params":{"channel":"2"}}',
'bannerUrl_3' => 'http://m.yohobuy.com/kids?openby:yohobuy={"action":"go.home","params":{"channel":"3"}}',
'bannerUrl_4' => 'http://m.yohobuy.com/lifestyle?openby:yohobuy={"action":"go.home","params":{"channel":"4"}}',
'playAgain' => 'http://feature.yoho.cn/2016lishifeng/index.html',
));
}
/**
* 检测登录状态
*
* @return int
*/
private function getLoggedUid()
{
// 判断是否是应用访问, 拼接APP需要的URL参数
$this->_isApp = (null !== $this->get('app_version') || null !== $this->get('uid'));
$uid = false;
if ($this->_isApp) {
$uid = $this->get('uid');
} else {
$uid = $this->getUid();
}
return $uid;
}
/**
* 发送站内信
*
* @param int $uid 用户ID
*/
private function sendMessage($uid, $title, $content)
{
try {
ActivityData::message($uid, $title, $content);
} catch (Exception $e) {
// do nothing
}
}
/**
* 根据环境来获取活动ID
*
* @return int
*/
private function getActivityId()
{
// 设置环境变量
switch (APPLICATION_ENV) {
case 'production': // 生产
return 462;
case 'preview': // 预览
case 'testing': // 测试
case 'develop': // 开发
default:
return 88;
}
}
}
... ...
... ... @@ -28,8 +28,10 @@ class RegController extends AbstractAction
$data['areaCode'] = '+86'; // 默认的区号
$data['countrys'] = RegData::getAreasData(); // 地区信息列表
$refer = $this->get('refer', SITE_MAIN . '/?go=1');
$refer = $this->get('refer');
if (!empty($refer)) {
$this->setCookie('refer', $refer);
}
// 生成HTML(reg.html)
//$this->_view->html('reg');
... ...