Life.php
3.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php
use Action\AbstractAction;
use Plugin\Helpers;
use LibModels\Wap\Coupon\CouponData;
class LifeController extends AbstractAction
{
const COUPON_ID = 23360;
public function indexAction()
{
$uid = $this->getUid();
if (!$uid) {
$this->go(Helpers::url('/signin.html', array('refer' => Helpers::url('/life/index'))));
}
$this->_view->display('index', array(
'wxshare' => array(
'shareLink' => 'http://m.yohobuy.com/life/index',
'shareImg' => 'http://img02.yohoboys.com/staticimg/2016/05/26/17/0208d70abf2b3fc94412f0e4d84f6728df.png',
'shareTitle' => 'YOHO!BUY有货清凉夏日福利券限时派送中 ',
'shareDesc' => '我已成功领取36元清凉夏日福利券,你也快来吧!',
),
));
}
//点击领券按钮
public function sendCouponAction()
{
$result = array('code' => 400, 'message' => '领取失败', 'data' => '');
do {
if (!$this->isAjax()) {
break;
}
//获取领券参数
$couponId = self::COUPON_ID;
$uid = $this->getUid();
//领取优惠券
$result = CouponData::receiveCoupon($uid, $couponId);
if (!isset($result['code'])) {
break;
}
}
while (false);
$this->echoJson($result);
}
public function loginAction()
{
$uid = $this->getUid();
if (!$uid) {
$this->go(Helpers::url('/signin.html', array('refer' => Helpers::url('/life/index'))));
}
$this->_view->display('login', array(
'wxshare' => array(
'shareLink' => 'http://m.yohobuy.com/life/index',
'shareImg' => 'http://img02.yohoboys.com/staticimg/2016/05/26/17/0208d70abf2b3fc94412f0e4d84f6728df.png',
'shareTitle' => 'YOHO!BUY有货清凉夏日福利券限时派送中 ',
'shareDesc' => '我已成功领取36元清凉夏日福利券,你也快来吧!',
),
'lifePage' => true));
}
public function couponAction()
{
//获取手机号,传优惠码
$this->_view->display('coupon', array(
'wxshare' => array(
'shareLink' => 'http://m.yohobuy.com/life/index',
'shareImg' => 'http://img02.yohoboys.com/staticimg/2016/05/26/17/0208d70abf2b3fc94412f0e4d84f6728df.png',
'shareTitle' => 'YOHO!BUY有货清凉夏日福利券限时派送中 ',
'shareDesc' => '我已成功领取36元清凉夏日福利券,你也快来吧!',
),
'couponPage' => true));
}
public function getSignPackageAction()
{
$curl = 'http://www.yohoshow.com/api/wechat/getSignPackage';
$pageurl = $this->get('pageurl', '');
$callback = $this->get('callback', '');
$url = $curl . '?pageurl=' . urlencode($pageurl) . "&callback=" . $callback;
$res = file_get_contents($url);
echo $res;
exit;
}
}