Authored by 郭成尧

'领券操作接口修改'

@@ -46,7 +46,7 @@ @@ -46,7 +46,7 @@
46 data: { 46 data: {
47 'couponIds': '8024, 2564 , 3587' 47 'couponIds': '8024, 2564 , 3587'
48 }, 48 },
49 - dataType: 'html', 49 + dataType: 'json',
50 success: function (data) { 50 success: function (data) {
51 alert(data); 51 alert(data);
52 }, 52 },
@@ -72,31 +72,23 @@ class CouponController extends AbstractAction @@ -72,31 +72,23 @@ class CouponController extends AbstractAction
72 $receiveData = filter_input_array(INPUT_GET, array( 72 $receiveData = filter_input_array(INPUT_GET, array(
73 'couponIds' => FILTER_DEFAULT 73 'couponIds' => FILTER_DEFAULT
74 )); 74 ));
75 - $returnData =array(); 75 + $returnData = '';
76 $couponIds = explode(',', str_replace(' ', '', $receiveData['couponIds'])); 76 $couponIds = explode(',', str_replace(' ', '', $receiveData['couponIds']));
77 switch ($this->getCoupon($couponIds)){ 77 switch ($this->getCoupon($couponIds)){
78 case 1: 78 case 1:
79 - $returnData = [  
80 - 'message' => '领券成功!'  
81 - ]; 79 + $returnData = '领券成功!';
82 break; 80 break;
83 case 2: 81 case 2:
84 - $returnData = [  
85 - 'message' => '领券失败!'  
86 - ]; 82 + $returnData = '领券失败!';
87 break; 83 break;
88 case 3: 84 case 3:
89 - $returnData = [  
90 - 'message' => '券已经被领光了!'  
91 - ]; 85 + $returnData = '券已经被领光了!';
92 break; 86 break;
93 default: 87 default:
94 - $returnData = [  
95 - 'message' => '未知错误!'  
96 - ]; 88 + $returnData = '未知错误!';
97 break; 89 break;
98 } 90 }
99 - $this->_view->display('receive-coupon', $returnData); 91 + echo json_encode($returnData);
100 } 92 }
101 93
102 /** 94 /**