Authored by 郭成尧

'领券操作接口修改'

... ... @@ -46,7 +46,7 @@
data: {
'couponIds': '8024, 2564 , 3587'
},
dataType: 'html',
dataType: 'json',
success: function (data) {
alert(data);
},
... ...
... ... @@ -72,31 +72,23 @@ class CouponController extends AbstractAction
$receiveData = filter_input_array(INPUT_GET, array(
'couponIds' => FILTER_DEFAULT
));
$returnData =array();
$returnData = '';
$couponIds = explode(',', str_replace(' ', '', $receiveData['couponIds']));
switch ($this->getCoupon($couponIds)){
case 1:
$returnData = [
'message' => '领券成功!'
];
$returnData = '领券成功!';
break;
case 2:
$returnData = [
'message' => '领券失败!'
];
$returnData = '领券失败!';
break;
case 3:
$returnData = [
'message' => '券已经被领光了!'
];
$returnData = '券已经被领光了!';
break;
default:
$returnData = [
'message' => '未知错误!'
];
$returnData = '未知错误!';
break;
}
$this->_view->display('receive-coupon', $returnData);
echo json_encode($returnData);
}
/**
... ...