Authored by hf

Merge branch 'gamecoupon'

  1 +* {
  2 + margin: 0;
  3 + padding: 0;
  4 +}
  5 +.coupon-container img {
  6 + display: block;
  7 + max-width: 100%;
  8 +}
  9 +
  10 +.coupon-top {
  11 + position: relative;
  12 +}
  13 +.coupon-top .go-check {
  14 + position: absolute;
  15 + bottom: 7.075rem;
  16 + width: 100%;
  17 + height: 3.0rem;
  18 +}
  19 +.coupon-top .app-btn {
  20 + position: absolute;
  21 + width: 7.55rem;
  22 + height: 4.0rem;
  23 + bottom: 1.6rem;
  24 +}
  25 +.coupon-top .app-btn.app1{
  26 + left: 0.325rem
  27 +}
  28 +.coupon-top .app-btn.app2{
  29 + right: 0.325rem
  30 +}
  31 +.coupon-bottom {
  32 + height: 24.125rem;
  33 + background: url(../../img/newyear/160105/bottom-bg.png) no-repeat bottom center;
  34 + background-size: 100% 100%;
  35 +}
  36 +
  37 +.coupon-banner {
  38 + text-align: center;
  39 + font-size: 0;
  40 +}
  41 +.coupon-banner a {
  42 + display: inline-block;
  43 + width: 6.6rem;
  44 + height: 6.6rem;
  45 + margin: 0 0.25rem 0.55rem;
  46 +}
  47 +
  48 +.coupon-bottom .follow-yoho {
  49 + display: block;
  50 + margin: 1.5rem auto 0;
  51 + width: 10.175rem;
  52 + height: 2.675rem;
  53 +}
  54 +
  55 +.bottom-btn {
  56 + margin: 1.95rem 0 0;
  57 + font-size: 0;
  58 + text-align: center;
  59 +}
  60 +.bottom-btn a {
  61 + display: inline-block;
  62 + margin: 0 1.25rem;
  63 + width: 5.225rem;
  64 + height: 2.0rem;
  65 +}
  66 +.modal {
  67 + position: fixed;
  68 + top: 0;
  69 + right: 0;
  70 + bottom: 0;
  71 + left: 0;
  72 + background: url(../../img/newyear/160105/share.png) center top no-repeat;
  73 + -webkit-background-size: 100%;
  74 + -moz-background-size: 100%;
  75 + background-size: 100%;
  76 + display: none;
  77 +}
  78 +
  79 +.has-done {
  80 + position: fixed;
  81 + top: 0;
  82 + right: 0;
  83 + bottom: 0;
  84 + left: 0;
  85 + background: rgba(0,0,0,0.4) url(../../img/newyear/160105/11.png);
  86 + background-repeat: no-repeat;
  87 + background-size: 80% auto;
  88 + background-position: center center;
  89 + overflow: hidden;
  90 + display: none;
  91 +}
  92 +
  93 +.dialog-box {
  94 + display: none;
  95 + position: fixed;
  96 + top: 0;
  97 + right: 0;
  98 + bottom: 0;
  99 + left: 0;
  100 + background: rgba(0,0,0,0.4);
  101 + z-index: 999;
  102 +}
  103 +
  104 +.dialog-inner {
  105 + position: absolute;
  106 + width: 13.375rem;
  107 + height: 9.625rem;
  108 + top: 50%;
  109 + left: 50%;
  110 + margin: -4.8125rem 0 0 -6.6875rem;
  111 +}
  112 +
  113 +.dialog-inner img {
  114 + max-width: 100%;
  115 +}
  116 +
  117 +.dialog-inner span {
  118 + position: absolute;
  119 + width: 9rem;
  120 + height: 1.85rem;
  121 + bottom: 0.6rem;
  122 + left: 50%;
  123 + margin: 0 0 0 -4.5rem;
  124 + cursor: pointer;
  125 +}
  1 +<!DOCTYPE html>
  2 +<html>
  3 +<head>
  4 + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  5 + <meta charset="utf-8">
  6 + <title>{{staticTitle}}</title>
  7 + <meta name="apple-mobile-web-app-title" content="SUMMER SALE">
  8 + <meta name="format-detection" content="telephone=no">
  9 + <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no,minimal-ui" media="(device-height: 568px)">
  10 + <meta name="apple-mobile-web-app-capable" content="yes">
  11 + <meta name="apple-mobile-web-app-status-bar-style" content="grey">
  12 + <link rel="stylesheet" href="{{imgUrl}}/cuxiao/css/newyear/index-2.css">
  13 + <script>
  14 + (function(doc, win) {
  15 + var docEl = doc.documentElement;
  16 + (function() {
  17 + var clientWidth = docEl.clientWidth;
  18 + if (!clientWidth) {
  19 + return;
  20 + }
  21 + docEl.style.fontSize = 20 * (clientWidth / 320) + 'px';
  22 + }());
  23 + })(document, window);
  24 + </script>
  25 +</head>
  26 +<body class="keBody">
  27 +<div class="coupon-container" show="{{showPopupFlag}}">
  28 + <div class="coupon-top">
  29 + <img src="{{imgUrl}}/cuxiao/img/newyear/160105/top-bg.png" alt="">
  30 + <a class="go-check" href="{{myCouponUrl}}"></a>
  31 + <a class="app-btn app1" href="http://a.app.qq.com/o/simple.jsp?pkgname=com.yoho&g_f=995445"></a>
  32 + <a class="app-btn app2" href="http://www.yohoshow.com/about/index/yohobuyqr"></a>
  33 + </div>
  34 + <div class="coupon-bottom">
  35 + <div class="coupon-banner">
  36 + <a href="{{bannerUrl_1}}"></a>
  37 + <a href="{{bannerUrl_2}}"></a>
  38 + <a href="{{bannerUrl_3}}"></a>
  39 + <a href="{{bannerUrl_4}}"></a>
  40 + </div>
  41 + <a class="follow-yoho" href="http://mp.weixin.qq.com/s?__biz=MjM5ODI5MDA4MA==&amp;mid=201849402&amp;idx=1&amp;sn=c0089812f9769d82e0075f69d771f6e1#rd"></a>
  42 + <div class="bottom-btn">
  43 + <a class="play-again" href="{{playAgain}}"></a>
  44 + <a class="share-btn" href="javascript:;"></a>
  45 + </div>
  46 + </div>
  47 + <div class="coupon-ft">
  48 + <img src="{{imgUrl}}/cuxiao/img/newyear/160105/14.png">
  49 + </div>
  50 +</div>
  51 +<div class="modal"></div>
  52 +<div class="dialog-box geted">
  53 + <div class="dialog-inner">
  54 + <img src="{{imgUrl}}/cuxiao/img/newyear/160105/geted.png" alt=""/>
  55 + <span class="dialog-close"></span>
  56 + </div>
  57 +</div>
  58 +
  59 +<div class="dialog-box fail">
  60 + <div class="dialog-inner">
  61 + <img src="{{imgUrl}}/cuxiao/img/newyear/160105/fail.png" alt=""/>
  62 + <span class="refresh-btn"></span>
  63 + </div>
  64 +</div>
  65 +<input id="shareLink" type="hidden" value="{{shareLink}}">
  66 +<input id="shareImg" type="hidden" value="{{shareImg}}">
  67 +<input id="shareTitle" type="hidden" value="{{shareTitle}}">
  68 +<input id="shareDesc" type="hidden" value="{{shareDesc}}">
  69 +<script type="text/javascript" src="{{imgUrl}}/cuxiao/js/jquery.min.js"></script>
  70 +<script>
  71 + //提示分享
  72 + $('.share-btn').click(function () {
  73 + $('.modal').fadeIn();
  74 + });
  75 + //关闭提示分享
  76 + $('.modal').click(function () {
  77 + $(this).fadeOut();
  78 + });
  79 +
  80 + //提示已领过券
  81 + if ($('.coupon-container').attr('show') === '1') {
  82 + $('.dialog-box.geted').show();
  83 + }
  84 + //提示领券失败
  85 + else if ($('.coupon-container').attr('show') === '2') {
  86 + $('.dialog-box.fail').show();
  87 + }
  88 +
  89 + //关闭提示
  90 + $('.dialog-close').click(function(){
  91 + $(this).parents('.dialog-box').fadeOut();
  92 + });
  93 + //刷新页面
  94 + $('.refresh-btn').click(function() {
  95 + location.reload();
  96 + });
  97 +</script>
  98 +{{#if weixinShare}}
  99 +<script type="text/javascript" charset="utf-8" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
  100 +<script type="text/javascript" charset="utf-8" src="{{jsUrl}}/cuxiao/js/share.weixin.js"></script>
  101 +{{/if}}
  102 +{{> layout/analysis}}
  103 +</body>
  104 +</html>
  1 +<?php
  2 +use Action\HuodongAction;
  3 +use LibModels\Wap\Cuxiao\ActivityData;
  4 +use Plugin\Helpers;
  5 +
  6 +/**
  7 + *
  8 + * @name Newyear
  9 + * @package
  10 + * @copyright yoho.inc
  11 + * @version 1.0 (2015-12-30 20:39:50)
  12 + * @author fei.hong <fei.hong@yoho.cn>
  13 + */
  14 +class NewyearController extends HuodongAction
  15 +{
  16 + /**
  17 + * 利是封领券
  18 + *
  19 + * 备注:2016年1月5号上线
  20 + */
  21 + public function couponAction()
  22 + {
  23 + //获取登录者ID,未登录返回false
  24 + $uid = $this->getLoggedUid();
  25 + if (!$uid || !is_numeric($uid)) {
  26 + //未登录的用户访问,跳转到登录页面。并且在登陆后跳转回本页面
  27 + $this->go(Helpers::url('/signin.html', array('refer' => Helpers::url('/cuxiao/newyear/coupon')), 'default'));
  28 + }
  29 +
  30 + // 该变量用来控制和显示页面的弹出提示
  31 + $showPopupFlag = '0';
  32 +
  33 + //获取跳转到个人中心-我的优惠券链接,并调用接口,完成领券操作
  34 + $myCouponUrl = Helpers::url('/home/coupons', null, 'default') . '?openby:yohobuy={"action":"go.coupon"}';
  35 + $activityId = $this->getActivityId();
  36 + $result = ActivityData::getCouponAll($uid, $activityId);
  37 + if (isset($result['code'])) {
  38 + switch (intval($result['code'])) {
  39 + case 200: // 领取成功, 发送站内信消息
  40 + $showPopupFlag = '0';
  41 + $this->sendMessage($uid, '【优惠券】您有1000元套券', '尊敬的客户:恭喜您成功获得1000元套券 !您可以在个人中心的交易管理中查看‘我的优惠券’。');
  42 + break;
  43 + case 201: // 已领取过, 提示重复领券
  44 + $showPopupFlag = '1';
  45 + break;
  46 + default: // 领取失败, 提示领券失败
  47 + $showPopupFlag = '2';
  48 + break;
  49 + }
  50 + }
  51 +
  52 + $this->_view->display('coupon', array(
  53 + 'staticTitle' => 'YOHO!BUY有货新年寻宝大作战',
  54 + 'weixinShare' => $this->_isApp ? false : true, // 是否需要微信分享
  55 + 'shareLink' => 'http://feature.yoho.cn/2016lishifeng/index.html',
  56 + 'shareTitle' => 'YOHO!BUY有货新年寻宝大作战,千元利是等你赢!',
  57 + 'shareDesc' => 'YOHO!BUY有货,全球800+潮流品牌每日上新!',
  58 + 'shareImg' => 'http://img12.static.yhbimg.com/couponImg/2015/12/30/12/02008a9724b898dee56852de9f1a3978bf.jpg',
  59 + 'showPopupFlag' => $showPopupFlag,
  60 + 'myCouponUrl' => $myCouponUrl,
  61 + 'bannerUrl_1' => 'http://m.yohobuy.com/boys?openby:yohobuy={"action":"go.home","params":{"channel":"1"}}',
  62 + 'bannerUrl_2' => 'http://m.yohobuy.com/girls?openby:yohobuy={"action":"go.home","params":{"channel":"2"}}',
  63 + 'bannerUrl_3' => 'http://m.yohobuy.com/kids?openby:yohobuy={"action":"go.home","params":{"channel":"3"}}',
  64 + 'bannerUrl_4' => 'http://m.yohobuy.com/lifestyle?openby:yohobuy={"action":"go.home","params":{"channel":"4"}}',
  65 + 'playAgain' => 'http://feature.yoho.cn/2016lishifeng/index.html',
  66 + ));
  67 + }
  68 +
  69 + /**
  70 + * 检测登录状态
  71 + *
  72 + * @return int
  73 + */
  74 + private function getLoggedUid()
  75 + {
  76 + // 判断是否是应用访问, 拼接APP需要的URL参数
  77 + $this->_isApp = (null !== $this->get('app_version') || null !== $this->get('uid'));
  78 + $uid = false;
  79 + if ($this->_isApp) {
  80 + $uid = $this->get('uid');
  81 + } else {
  82 + $uid = $this->getUid();
  83 + }
  84 +
  85 + return $uid;
  86 + }
  87 +
  88 + /**
  89 + * 发送站内信
  90 + *
  91 + * @param int $uid 用户ID
  92 + */
  93 + private function sendMessage($uid, $title, $content)
  94 + {
  95 + try {
  96 + ActivityData::message($uid, $title, $content);
  97 + } catch (Exception $e) {
  98 + // do nothing
  99 + }
  100 + }
  101 +
  102 + /**
  103 + * 根据环境来获取活动ID
  104 + *
  105 + * @return int
  106 + */
  107 + private function getActivityId()
  108 + {
  109 + // 设置环境变量
  110 + switch (APPLICATION_ENV) {
  111 + case 'production': // 生产
  112 + return 462;
  113 + case 'preview': // 预览
  114 + case 'testing': // 测试
  115 + case 'develop': // 开发
  116 + default:
  117 + return 88;
  118 + }
  119 + }
  120 +
  121 +}
@@ -28,8 +28,10 @@ class RegController extends AbstractAction @@ -28,8 +28,10 @@ class RegController extends AbstractAction
28 $data['areaCode'] = '+86'; // 默认的区号 28 $data['areaCode'] = '+86'; // 默认的区号
29 $data['countrys'] = RegData::getAreasData(); // 地区信息列表 29 $data['countrys'] = RegData::getAreasData(); // 地区信息列表
30 30
31 - $refer = $this->get('refer', SITE_MAIN . '/?go=1');  
32 - $this->setCookie('refer', $refer); 31 + $refer = $this->get('refer');
  32 + if (!empty($refer)) {
  33 + $this->setCookie('refer', $refer);
  34 + }
33 35
34 // 生成HTML(reg.html) 36 // 生成HTML(reg.html)
35 //$this->_view->html('reg'); 37 //$this->_view->html('reg');