Life.php
1.45 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
<?php
use Action\AbstractAction;
use Plugin\Helpers;
use LibModels\Wap\Coupon\CouponData;
class LifeController extends AbstractAction
{
const COUPON_ID = 13026;
public function indexAction()
{
$uid = $this->getUid();
if (!$uid) {
$this->go(Helpers::url('/signin.html', array('refer' => Helpers::url('/life/index'))));
}
$this->_view->display('index');
}
//点击领券按钮
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(
'lifePage' => true));
}
public function couponAction()
{
//获取手机号,传优惠码
$this->_view->display('coupon', array(
'couponPage' => true));
}
}