Authored by liangxs

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
... ... @@ -24,7 +24,25 @@
</div>
{{/ coupons}}
</div>
<div class="coupon-mask"> </div>
<div class="coupon-message"></div>
{{/floor}}
{{> layout/footer}}
\ No newline at end of file
{{> layout/footer}}
<script type="application/javascript">
function receiveCoupon() {
$.ajax({
url: 'http://m.dev.yohobuy.com/coupon/receiveCoupon',
method: 'GET',
data: {
'couponIds': '8024, 2564 , 3587'
},
dataType: 'json',
success: function (data) {
alert(data);
},
error: function (error) {
alert(error);
}
});
}
</script>
\ No newline at end of file
... ...
... ... @@ -76,31 +76,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);
}
/**
... ...