Authored by hf

do add cuxiao christmas page

@@ -36,7 +36,7 @@ class ChristmasController extends HuodongAction @@ -36,7 +36,7 @@ class ChristmasController extends HuodongAction
36 switch (intval($result['code'])) { 36 switch (intval($result['code'])) {
37 case 200: // 领取成功, 发送站内信消息 37 case 200: // 领取成功, 发送站内信消息
38 $showPopupFlag = '0'; 38 $showPopupFlag = '0';
39 - $this->sendMessage($uid); 39 + $this->sendMessage($uid, '【优惠券】您有6张潮集圣诞优惠券', '尊敬的客户:恭喜您成功获得6张潮集圣诞优惠券 !您可以在个人中心的交易管理中查看‘我的优惠券’。');
40 break; 40 break;
41 case 201: // 已领取过, 提示重复领券 41 case 201: // 已领取过, 提示重复领券
42 $showPopupFlag = '1'; 42 $showPopupFlag = '1';
@@ -49,13 +49,59 @@ class ChristmasController extends HuodongAction @@ -49,13 +49,59 @@ class ChristmasController extends HuodongAction
49 49
50 $this->_view->display('index', array( 50 $this->_view->display('index', array(
51 'staticTitle' => '潮集圣诞', 51 'staticTitle' => '潮集圣诞',
52 -  
53 'weixinShare' => $this->_isApp ? false : true, // 是否需要微信分享 52 'weixinShare' => $this->_isApp ? false : true, // 是否需要微信分享
54 'shareLink' => 'http://feature.yohobuy.com/0/0/675/index.html', 53 'shareLink' => 'http://feature.yohobuy.com/0/0/675/index.html',
55 'shareTitle' => 'YOHO!BUY有货【潮集圣诞】第一弹来袭!500元优惠券引爆圣诞!', 54 'shareTitle' => 'YOHO!BUY有货【潮集圣诞】第一弹来袭!500元优惠券引爆圣诞!',
56 'shareDesc' => '万件潮品限时58折封顶,再享折上满减,还有惊喜圣诞礼物等你来挑哦!', 55 'shareDesc' => '万件潮品限时58折封顶,再享折上满减,还有惊喜圣诞礼物等你来挑哦!',
57 'shareImg' => 'http://img12.static.yhbimg.com/couponImg/2015/12/10/09/029fd41969b67002126ff7a71fe5396b6e.png', 56 'shareImg' => 'http://img12.static.yhbimg.com/couponImg/2015/12/10/09/029fd41969b67002126ff7a71fe5396b6e.png',
  57 + 'showPopupFlag' => $showPopupFlag,
  58 + 'myCouponUrl' => $myCouponUrl,
  59 + 'bannerUrl_1' => 'http://feature.yoho.cn/1211/1211APPHOMEBOY/index.html?openby:yohobuy={"action":"go.h5","params":{"title":"潮集圣诞","url":"http://feature.yoho.cn/1211/1211APPHOMEBOY/index.html?","share":"\/operations\/api\/v5\/webshare\/getShare","shareparam":{"share_id":"454"},"param":{"share_id":"454"}}}',
  60 + 'bannerUrl_2' => 'http://feature.yoho.cn/1211/1211APPHOMEGIRL/index.html?openby:yohobuy={"action":"go.h5","params":{"title":"潮集圣诞","url":"http://feature.yoho.cn/1211/1211APPHOMEGIRL/index.html?","share":"\/operations\/api\/v5\/webshare\/getShare","shareparam":{"share_id":"456"},"param":{"share_id":"456"}}}',
  61 + ));
  62 + }
  63 +
  64 + /**
  65 + * 备注:2015年12月11号上线
  66 + */
  67 + public function christmas2Action()
  68 + {
  69 + //获取登录者ID,未登录返回false
  70 + $uid = $this->getLoggedUid();
  71 + if (!$uid || !is_numeric($uid)) {
  72 + //未登录的用户访问,跳转到登录页面。并且在登陆后跳转回本页面
  73 + $this->go(Helpers::url('/signin.html', array('refer' => Helpers::url('/cuxiao/christmas/christmas2')), 'default'));
  74 + }
  75 +
  76 + // 该变量用来控制和显示页面的弹出提示
  77 + $showPopupFlag = '0';
  78 +
  79 + //获取跳转到个人中心-我的优惠券链接,并调用接口,完成领券操作
  80 + $myCouponUrl = Helpers::url('/home/coupons', null, 'default') . '?openby:yohobuy={"action":"go.coupon"}';
  81 + $activityId = $this->getActivityId2();
  82 + $result = ActivityData::getCouponAll($uid, $activityId);
  83 + if (isset($result['code'])) {
  84 + switch (intval($result['code'])) {
  85 + case 200: // 领取成功, 发送站内信消息
  86 + $showPopupFlag = '0';
  87 + $this->sendMessage($uid, '【优惠券】您获得1000元套券', '尊敬的客户:恭喜您成功获得1000元套券!您可以在个人中心的交易管理中查看‘我的优惠券’。');
  88 + break;
  89 + case 201: // 已领取过, 提示重复领券
  90 + $showPopupFlag = '1';
  91 + break;
  92 + default: // 领取失败, 提示领券失败
  93 + $showPopupFlag = '2';
  94 + break;
  95 + }
  96 + }
58 97
  98 + $this->_view->display('index', array(
  99 + 'staticTitle' => '潮集圣诞',
  100 + 'weixinShare' => $this->_isApp ? false : true, // 是否需要微信分享
  101 + 'shareLink' => 'http://feature.yohobuy.com/0/0/701/index.html',
  102 + 'shareTitle' => 'YOHO!BUY有货【潮集圣诞】第二弹来袭!1000元优惠券引爆圣诞!',
  103 + 'shareDesc' => '万件潮品限时5折封顶,冬季优品最高直减800元,还有惊喜圣诞礼物等你来挑哦!',
  104 + 'shareImg' => 'http://img12.static.yhbimg.com/couponImg/2015/12/10/09/029fd41969b67002126ff7a71fe5396b6e.png',
59 'showPopupFlag' => $showPopupFlag, 105 'showPopupFlag' => $showPopupFlag,
60 'myCouponUrl' => $myCouponUrl, 106 'myCouponUrl' => $myCouponUrl,
61 'bannerUrl_1' => 'http://feature.yoho.cn/1211/1211APPHOMEBOY/index.html?openby:yohobuy={"action":"go.h5","params":{"title":"潮集圣诞","url":"http://feature.yoho.cn/1211/1211APPHOMEBOY/index.html?","share":"\/operations\/api\/v5\/webshare\/getShare","shareparam":{"share_id":"454"},"param":{"share_id":"454"}}}', 107 'bannerUrl_1' => 'http://feature.yoho.cn/1211/1211APPHOMEBOY/index.html?openby:yohobuy={"action":"go.h5","params":{"title":"潮集圣诞","url":"http://feature.yoho.cn/1211/1211APPHOMEBOY/index.html?","share":"\/operations\/api\/v5\/webshare\/getShare","shareparam":{"share_id":"454"},"param":{"share_id":"454"}}}',
@@ -87,12 +133,11 @@ class ChristmasController extends HuodongAction @@ -87,12 +133,11 @@ class ChristmasController extends HuodongAction
87 * 133 *
88 * @param int $uid 用户ID 134 * @param int $uid 用户ID
89 */ 135 */
90 - private function sendMessage($uid) 136 + private function sendMessage($uid, $title, $content)
91 { 137 {
92 try { 138 try {
93 - ActivityData::message($uid, '【优惠券】您有6张潮集圣诞优惠券', '尊敬的客户:恭喜您成功获得6张潮集圣诞优惠券 !您可以在个人中心的交易管理中查看‘我的优惠券’。');  
94 - }  
95 - catch (Exception $e) { 139 + ActivityData::message($uid, $title, $content);
  140 + } catch (Exception $e) {
96 // do nothing 141 // do nothing
97 } 142 }
98 } 143 }
@@ -116,4 +161,23 @@ class ChristmasController extends HuodongAction @@ -116,4 +161,23 @@ class ChristmasController extends HuodongAction
116 } 161 }
117 } 162 }
118 163
  164 + /**
  165 + * 根据环境来获取活动ID
  166 + *
  167 + * @return int
  168 + */
  169 + private function getActivityId2()
  170 + {
  171 + // 设置环境变量
  172 + switch (APPLICATION_ENV) {
  173 + case 'production': // 生产
  174 + return 390;
  175 + case 'preview': // 预览
  176 + case 'testing': // 测试
  177 + case 'develop': // 开发
  178 + default:
  179 + return 85;
  180 + }
  181 + }
  182 +
119 } 183 }