Merge branch 'feature/coupon' of http://git.dev.yoho.cn/web/yohobuy into feature/coupon
# Conflicts: # template/m.yohobuy.com/actions/index/coupon/index.phtml
Showing
3 changed files
with
25 additions
and
16 deletions
@@ -24,7 +24,25 @@ | @@ -24,7 +24,25 @@ | ||
24 | </div> | 24 | </div> |
25 | {{/ coupons}} | 25 | {{/ coupons}} |
26 | </div> | 26 | </div> |
27 | + | ||
27 | <div class="coupon-mask"> </div> | 28 | <div class="coupon-mask"> </div> |
28 | <div class="coupon-message"></div> | 29 | <div class="coupon-message"></div> |
29 | - {{/floor}} | ||
30 | {{> layout/footer}} | 30 | {{> layout/footer}} |
31 | +<script type="application/javascript"> | ||
32 | + function receiveCoupon() { | ||
33 | + $.ajax({ | ||
34 | + url: 'http://m.dev.yohobuy.com/coupon/receiveCoupon', | ||
35 | + method: 'GET', | ||
36 | + data: { | ||
37 | + 'couponIds': '8024, 2564 , 3587' | ||
38 | + }, | ||
39 | + dataType: 'json', | ||
40 | + success: function (data) { | ||
41 | + alert(data); | ||
42 | + }, | ||
43 | + error: function (error) { | ||
44 | + alert(error); | ||
45 | + } | ||
46 | + }); | ||
47 | + } | ||
48 | +</script> |
1 | -<div>信息:{{message}}</div> |
@@ -76,31 +76,23 @@ class CouponController extends AbstractAction | @@ -76,31 +76,23 @@ class CouponController extends AbstractAction | ||
76 | $receiveData = filter_input_array(INPUT_GET, array( | 76 | $receiveData = filter_input_array(INPUT_GET, array( |
77 | 'couponIds' => FILTER_DEFAULT | 77 | 'couponIds' => FILTER_DEFAULT |
78 | )); | 78 | )); |
79 | - $returnData =array(); | 79 | + $returnData = ''; |
80 | $couponIds = explode(',', str_replace(' ', '', $receiveData['couponIds'])); | 80 | $couponIds = explode(',', str_replace(' ', '', $receiveData['couponIds'])); |
81 | switch ($this->getCoupon($couponIds)){ | 81 | switch ($this->getCoupon($couponIds)){ |
82 | case 1: | 82 | case 1: |
83 | - $returnData = [ | ||
84 | - 'message' => '领券成功!' | ||
85 | - ]; | 83 | + $returnData = '领券成功!'; |
86 | break; | 84 | break; |
87 | case 2: | 85 | case 2: |
88 | - $returnData = [ | ||
89 | - 'message' => '领券失败!' | ||
90 | - ]; | 86 | + $returnData = '领券失败!'; |
91 | break; | 87 | break; |
92 | case 3: | 88 | case 3: |
93 | - $returnData = [ | ||
94 | - 'message' => '券已经被领光了!' | ||
95 | - ]; | 89 | + $returnData = '券已经被领光了!'; |
96 | break; | 90 | break; |
97 | default: | 91 | default: |
98 | - $returnData = [ | ||
99 | - 'message' => '未知错误!' | ||
100 | - ]; | 92 | + $returnData = '未知错误!'; |
101 | break; | 93 | break; |
102 | } | 94 | } |
103 | - $this->_view->display('receive-coupon', $returnData); | 95 | + echo json_encode($returnData); |
104 | } | 96 | } |
105 | 97 | ||
106 | /** | 98 | /** |
-
Please register or login to post a comment