Showing
1 changed file
with
15 additions
and
5 deletions
@@ -77,17 +77,27 @@ class CouponController extends AbstractAction | @@ -77,17 +77,27 @@ class CouponController extends AbstractAction | ||
77 | $receiveData = filter_input_array(INPUT_GET, array( | 77 | $receiveData = filter_input_array(INPUT_GET, array( |
78 | 'couponIds' => FILTER_DEFAULT | 78 | 'couponIds' => FILTER_DEFAULT |
79 | )); | 79 | )); |
80 | - $returnData = ''; | 80 | + $returnData = array(); |
81 | $couponIds = explode(',', str_replace(' ', '', $receiveData['couponIds'])); | 81 | $couponIds = explode(',', str_replace(' ', '', $receiveData['couponIds'])); |
82 | - switch ($this->getCoupon($couponIds)){ | 82 | + $returnStatus = $this->getCoupon($couponIds); |
83 | + switch ($returnStatus){ | ||
83 | case 1: | 84 | case 1: |
84 | - $returnData = '领券成功!'; | 85 | + $returnData = [ |
86 | + 'msg' => '领券成功!', | ||
87 | + 'status' => $returnStatus | ||
88 | + ]; | ||
85 | break; | 89 | break; |
86 | case 2: | 90 | case 2: |
87 | - $returnData = '领券失败!'; | 91 | + $returnData = [ |
92 | + 'msg' => '领券失败!', | ||
93 | + 'status' => $returnStatus | ||
94 | + ]; | ||
88 | break; | 95 | break; |
89 | case 3: | 96 | case 3: |
90 | - $returnData = '券已经被领光了!'; | 97 | + $returnData = [ |
98 | + 'msg' => '券已经被领光了!', | ||
99 | + 'status' => $returnStatus | ||
100 | + ]; | ||
91 | break; | 101 | break; |
92 | default: | 102 | default: |
93 | $returnData = '未知错误!'; | 103 | $returnData = '未知错误!'; |
-
Please register or login to post a comment