...
|
...
|
@@ -79,29 +79,17 @@ class CouponController extends AbstractAction |
|
|
));
|
|
|
$returnData = array();
|
|
|
$couponIds = explode(',', str_replace(' ', '', $receiveData['couponIds']));
|
|
|
$returnStatus = $this->getCoupon($couponIds);
|
|
|
switch ($returnStatus){
|
|
|
case 1:
|
|
|
$returnData = [
|
|
|
'msg' => '领券成功!',
|
|
|
'status' => $returnStatus
|
|
|
];
|
|
|
break;
|
|
|
case 2:
|
|
|
$returnData = [
|
|
|
'msg' => '领券失败!',
|
|
|
'status' => $returnStatus
|
|
|
];
|
|
|
break;
|
|
|
case 3:
|
|
|
$returnData = [
|
|
|
'msg' => '券已经被领光了!',
|
|
|
'status' => $returnStatus
|
|
|
];
|
|
|
break;
|
|
|
default:
|
|
|
$returnData = '未知错误!';
|
|
|
break;
|
|
|
$result = $this->getCoupons($couponIds);
|
|
|
if($result === 200){
|
|
|
$returnData = [
|
|
|
'msg' => '领券成功!',
|
|
|
'status' => true,
|
|
|
];
|
|
|
}else{
|
|
|
$returnData = [
|
|
|
'msg' => '领券失败!',
|
|
|
'status' => false,
|
|
|
];
|
|
|
}
|
|
|
echo json_encode($returnData);
|
|
|
}
|
...
|
...
|
@@ -113,12 +101,22 @@ class CouponController extends AbstractAction |
|
|
* @return array
|
|
|
* @internal param $couponId
|
|
|
*/
|
|
|
public function getCoupon($couponIds)
|
|
|
public function getCoupons($couponIds)
|
|
|
{
|
|
|
foreach ($couponIds as $key => $value) {
|
|
|
// 后端一些处理操作 + 1
|
|
|
if($couponIds){
|
|
|
$param['alg'] = 'SALT_MD5';
|
|
|
$param['code'] = 200;
|
|
|
$param['data']= '';
|
|
|
$param['md5'] = '50d19f5f5098c34607018f144baec14a';
|
|
|
$param['message'] = '操作成功';
|
|
|
}else{
|
|
|
$param['alg'] = 'SALT_MD5';
|
|
|
$param['code'] = 300;
|
|
|
$param['data']= '';
|
|
|
$param['md5'] = '50d19f5f5098c34607018f144baec14a';
|
|
|
$param['message'] = '操作失败';
|
|
|
}
|
|
|
return rand(1,4);
|
|
|
return $param;
|
|
|
}
|
|
|
|
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|