|
|
1
|
+<?php
|
|
|
2
|
+/**
|
|
|
3
|
+ * Created by PhpStorm.
|
|
|
4
|
+ * User: Administrator
|
|
|
5
|
+ * Date: 2016/3/4
|
|
|
6
|
+ * Time: 11:53
|
|
|
7
|
+ */
|
|
|
8
|
+use Action\HuodongAction;
|
|
|
9
|
+use Cuxiao\GirldayModel;
|
|
|
10
|
+use Plugin\Helpers;
|
|
|
11
|
+
|
|
|
12
|
+/**
|
|
|
13
|
+ * 女生节第二波
|
|
|
14
|
+ */
|
|
|
15
|
+class GirldayController extends HuodongAction
|
|
|
16
|
+{
|
|
|
17
|
+
|
|
|
18
|
+ // const STATIC_FILE = 'http://localhost:2222/1.0.4';
|
|
|
19
|
+ const STATIC_FILE = 'http://cdn.yoho.cn/huodong/2016xinshili-2/1.0.4';
|
|
|
20
|
+
|
|
|
21
|
+ /**
|
|
|
22
|
+ * 检测登录状态
|
|
|
23
|
+ *
|
|
|
24
|
+ */
|
|
|
25
|
+ private function getLoggedUid()
|
|
|
26
|
+ {
|
|
|
27
|
+ if ($this->_isApp) {
|
|
|
28
|
+ $uid = $this->get('uid');
|
|
|
29
|
+ } else {
|
|
|
30
|
+ $uid = $this->getUid();
|
|
|
31
|
+ }
|
|
|
32
|
+
|
|
|
33
|
+ return $uid;
|
|
|
34
|
+ }
|
|
|
35
|
+
|
|
|
36
|
+ /**
|
|
|
37
|
+ * 判断是否登陆
|
|
|
38
|
+ */
|
|
|
39
|
+ private function checkLogin()
|
|
|
40
|
+ {
|
|
|
41
|
+ $playUrl = Helpers::url('/cuxiao/girlday/index');
|
|
|
42
|
+
|
|
|
43
|
+ if (!$this->getLoggedUid()) {
|
|
|
44
|
+ if (!$this->_isApp) {
|
|
|
45
|
+ $this->go(Helpers::url('/signin.html', array('refer' => $playUrl), 'default'));
|
|
|
46
|
+ } else {
|
|
|
47
|
+ $playUrlEncode = strtr($playUrl, array('/' => '\\/'));
|
|
|
48
|
+ $this->go($playUrl . '?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' . $playUrlEncode . '","param":{"from":"app"}},"requesturl":{"url":"","param":{}},"priority":"N"}}');
|
|
|
49
|
+ }
|
|
|
50
|
+ }
|
|
|
51
|
+ }
|
|
|
52
|
+
|
|
|
53
|
+ /**
|
|
|
54
|
+ * 领券活动页面控制器
|
|
|
55
|
+ */
|
|
|
56
|
+ public function indexAction()
|
|
|
57
|
+ {
|
|
|
58
|
+ $this->checkLogin();
|
|
|
59
|
+
|
|
|
60
|
+ //获取跳转到个人中心-我的优惠券链接,并调用接口,完成领券操作
|
|
|
61
|
+ $myCouponUrl = Helpers::url('/home/coupons', null, 'default') . '?openby:yohobuy={"action":"go.coupon"}';
|
|
|
62
|
+
|
|
|
63
|
+ $this->_view->display('index', array(
|
|
|
64
|
+ 'staticTitle' => 'YOHO!BUY有货【春潮新势力】',
|
|
|
65
|
+ 'staticFile' => self::STATIC_FILE,
|
|
|
66
|
+ 'staticJS' => array(
|
|
|
67
|
+ 'home.js'
|
|
|
68
|
+ ),
|
|
|
69
|
+ 'couponUrl' => $myCouponUrl, // 个人中心优惠券地址
|
|
|
70
|
+ 'isApp' => $this->_isApp,
|
|
|
71
|
+ 'getCouponUrl' => Helpers::url('/cuxiao/girlday/sendCoupon', array('uid' => $this->getLoggedUid())),
|
|
|
72
|
+ 'banner' => array(
|
|
|
73
|
+ 'img' => 'http://img02.yohoboys.com/staticimg/2016/03/10/10/02b9827b20adc91409b5301f2232dc9144.jpg',
|
|
|
74
|
+ 'url' => 'http://feature.yoho.cn/0310/0310APPHOME/index.html?openby:yohobuy={"action":"go.h5","params":{"title":"YOHO!BUY有货【春潮新势力】", "url":"http://feature.yoho.cn/0310/0310APPHOME/index.html?","share":"\/operations\/api\/v5\/webshare\/getShare","shareparam":{"share_id":"382"},"param":{"share_id":"382"}}}'
|
|
|
75
|
+ ),
|
|
|
76
|
+ 'selectUrl' => 'http://m.yohobuy.com/home/coupons?openby:yohobuy={"action":"go.coupon"}',
|
|
|
77
|
+ 'weixinUrl' => 'http://mp.weixin.qq.com/s?__biz=MjM5ODI5MDA4MA==&mid=201849402&idx=1&sn=c0089812f9769d82e0075f69d771f6e1#rd', // 微信关注地址
|
|
|
78
|
+ 'appUrl' => 'http://www.yohoshow.com/about/index/yohobuyqr', // APP 下载地址
|
|
|
79
|
+ 'shareTitle' => 'YOHO!BUY有货【春潮新势力】火力全开!320元优惠券限时派送中!',
|
|
|
80
|
+ 'shareDesc' => '换我做主,用新陪伴!白色情人节限时2件7折!',
|
|
|
81
|
+ 'shareImg' => 'http://img02.yohoboys.com/staticimg/2016/03/10/10/0298ef8fbbb543144af487fbcd6718041b.png',
|
|
|
82
|
+ 'shareLink' => 'http://feature.yoho.cn/0310/0310APPHOME/index.html'
|
|
|
83
|
+ ));
|
|
|
84
|
+ }
|
|
|
85
|
+
|
|
|
86
|
+ /**
|
|
|
87
|
+ * 领券接口
|
|
|
88
|
+ */
|
|
|
89
|
+ public function sendCouponAction()
|
|
|
90
|
+ {
|
|
|
91
|
+ $result = array('code' => 201);
|
|
|
92
|
+
|
|
|
93
|
+ do {
|
|
|
94
|
+ if (!$this->isAjax()) {
|
|
|
95
|
+ break;
|
|
|
96
|
+ }
|
|
|
97
|
+
|
|
|
98
|
+ $activityId = $this->getActivityId();
|
|
|
99
|
+ $uid = $this->getLoggedUid();
|
|
|
100
|
+ $result = GirldayModel::getGirldayCoupon($uid, $activityId);
|
|
|
101
|
+ } while (false);
|
|
|
102
|
+
|
|
|
103
|
+ $this->echoJson($result);
|
|
|
104
|
+ }
|
|
|
105
|
+
|
|
|
106
|
+ /**
|
|
|
107
|
+ * 根据环境来获取活动ID
|
|
|
108
|
+ *
|
|
|
109
|
+ * @return int
|
|
|
110
|
+ */
|
|
|
111
|
+ private function getActivityId()
|
|
|
112
|
+ {
|
|
|
113
|
+ // 设置环境变量
|
|
|
114
|
+ switch (APPLICATION_ENV) {
|
|
|
115
|
+ case 'production': // 生产
|
|
|
116
|
+ return 528;
|
|
|
117
|
+ case 'preview': // 预览
|
|
|
118
|
+ case 'testing': // 测试
|
|
|
119
|
+ case 'develop': // 开发
|
|
|
120
|
+ default:
|
|
|
121
|
+ return 528; //490
|
|
|
122
|
+ }
|
|
|
123
|
+ }
|
|
|
124
|
+
|
|
|
125
|
+} |