1
|
<?php
|
1
|
<?php
|
2
|
|
2
|
|
3
|
use Action\HuodongAction;
|
3
|
use Action\HuodongAction;
|
|
|
4
|
+use Index\UserModel;
|
4
|
use Plugin\Helpers;
|
5
|
use Plugin\Helpers;
|
5
|
-use LibModels\Wap\Cuxiao\ActivityData;
|
|
|
6
|
-use Api\Yohobuy;
|
|
|
7
|
|
6
|
|
8
|
/**
|
7
|
/**
|
9
|
* 元宵抽签活动
|
8
|
* 元宵抽签活动
|
|
@@ -15,8 +14,68 @@ class YuanxiaoController extends HuodongAction |
|
@@ -15,8 +14,68 @@ class YuanxiaoController extends HuodongAction |
15
|
*/
|
14
|
*/
|
16
|
public function indexAction()
|
15
|
public function indexAction()
|
17
|
{
|
16
|
{
|
18
|
- $this->_view->display('index', array(
|
|
|
19
|
- 'staticTitle' => '元宵抽签'
|
17
|
+ //获取登录者ID,未登录返回false
|
|
|
18
|
+ $uid = $this->getLoggedUid();
|
|
|
19
|
+ if (!$uid || !is_numeric($uid)) {
|
|
|
20
|
+ //未登录的用户访问,跳转到登录页面。并且在登陆后跳转回本页面
|
|
|
21
|
+ $this->go(Helpers::url('/signin.html', array('refer' => Helpers::url('/cuxiao/newyear/coupon')), 'default'));
|
|
|
22
|
+ }
|
|
|
23
|
+
|
|
|
24
|
+ // 该变量用来控制和显示页面的弹出提示
|
|
|
25
|
+ $showPopupFlag = '0';
|
|
|
26
|
+
|
|
|
27
|
+ $userData = UserModel::getUserProfileData($uid);
|
|
|
28
|
+
|
|
|
29
|
+ $result = array();
|
|
|
30
|
+ if (isset($result['code'])) {
|
|
|
31
|
+ switch (intval($result['code'])) {
|
|
|
32
|
+ case 200: // 领取成功, 发送站内信消息
|
|
|
33
|
+ $showPopupFlag = '0';
|
|
|
34
|
+ $this->sendMessage($uid, '【优惠券】您有1000元套券', '尊敬的客户:恭喜您成功获得1000元套券 !您可以在个人中心的交易管理中查看‘我的优惠券’。');
|
|
|
35
|
+ break;
|
|
|
36
|
+ case 201: // 已领取过, 提示重复领券
|
|
|
37
|
+ $showPopupFlag = '1';
|
|
|
38
|
+ break;
|
|
|
39
|
+ default: // 领取失败, 提示领券失败
|
|
|
40
|
+ $showPopupFlag = '2';
|
|
|
41
|
+ break;
|
|
|
42
|
+ }
|
|
|
43
|
+ }
|
|
|
44
|
+
|
|
|
45
|
+ $this->_view->display('coupon', array(
|
|
|
46
|
+ 'staticTitle' => 'YOHO!BUY有货新年寻宝大作战',
|
|
|
47
|
+ 'weixinShare' => $this->_isApp ? false : true, // 是否需要微信分享
|
|
|
48
|
+ 'shareLink' => 'http://feature.yoho.cn/2016lishifeng/index.html',
|
|
|
49
|
+ 'shareTitle' => 'YOHO!BUY有货新年寻宝大作战,千元利是等你赢!',
|
|
|
50
|
+ 'shareDesc' => 'YOHO!BUY有货,全球800+潮流品牌每日上新!',
|
|
|
51
|
+ 'shareImg' => 'http://img12.static.yhbimg.com/couponImg/2015/12/30/12/02008a9724b898dee56852de9f1a3978bf.jpg',
|
|
|
52
|
+ 'showPopupFlag' => $showPopupFlag,
|
|
|
53
|
+ 'useData' => $userData,
|
|
|
54
|
+ 'bannerUrl_1' => 'http://m.yohobuy.com/boys?openby:yohobuy={"action":"go.home","params":{"channel":"1"}}',
|
|
|
55
|
+ 'bannerUrl_2' => 'http://m.yohobuy.com/girls?openby:yohobuy={"action":"go.home","params":{"channel":"2"}}',
|
|
|
56
|
+ 'bannerUrl_3' => 'http://m.yohobuy.com/kids?openby:yohobuy={"action":"go.home","params":{"channel":"3"}}',
|
|
|
57
|
+ 'bannerUrl_4' => 'http://m.yohobuy.com/lifestyle?openby:yohobuy={"action":"go.home","params":{"channel":"4"}}',
|
|
|
58
|
+ 'playAgain' => 'http://feature.yoho.cn/2016lishifeng/index.html',
|
|
|
59
|
+ 'appUrl_1' => 'http://www.yohoshow.com/about/index/yohobuyqr',
|
|
|
60
|
+ 'appUrl_2' => 'http://www.yohoshow.com/about/index/yohoboysqr',
|
20
|
));
|
61
|
));
|
21
|
}
|
62
|
}
|
|
|
63
|
+
|
|
|
64
|
+ /**
|
|
|
65
|
+ * 检测登录状态
|
|
|
66
|
+ *
|
|
|
67
|
+ * @return int
|
|
|
68
|
+ */
|
|
|
69
|
+ private function getLoggedUid()
|
|
|
70
|
+ {
|
|
|
71
|
+ // 判断是否是应用访问, 拼接APP需要的URL参数
|
|
|
72
|
+ $this->_isApp = (null !== $this->get('app_version') || null !== $this->get('uid'));
|
|
|
73
|
+ if ($this->_isApp) {
|
|
|
74
|
+ $uid = $this->get('uid');
|
|
|
75
|
+ } else {
|
|
|
76
|
+ $uid = $this->getUid();
|
|
|
77
|
+ }
|
|
|
78
|
+
|
|
|
79
|
+ return $uid;
|
|
|
80
|
+ }
|
22
|
} |
81
|
} |