Browse Source

领券失败

master
Lemon 5 years ago
parent
commit
6aa9167b4d
  1. 6
      app/Constants/v3/ErrorCode.php
  2. 10
      app/Controller/v3/CouponController.php

6
app/Constants/v3/ErrorCode.php

@ -330,6 +330,12 @@ class ErrorCode extends AbstractConstants
*/ */
const COUPON_IS_NOT_NEW_USER = 1203; const COUPON_IS_NOT_NEW_USER = 1203;
/**
* 优惠券领取失败
* @Message("优惠券领取失败")
*/
const COUPON_RECEIVE_FAILURE = 1204;
/************************************/ /************************************/
/* 提现相关 1251-1300 */ /* 提现相关 1251-1300 */
/************************************/ /************************************/

10
app/Controller/v3/CouponController.php

@ -92,8 +92,8 @@ class CouponController extends BaseController
if($newUserCheck){ if($newUserCheck){
return $this->success( return $this->success(
[ [
'error' => true,
'error_text' => '不是新用户无法领券',
'status' => 'error',
'message' => '不是新用户无法领券',
'text'=>'关注懒族菜市微信公众号,更多精彩活动一手掌握!' 'text'=>'关注懒族菜市微信公众号,更多精彩活动一手掌握!'
] ]
); );
@ -111,6 +111,10 @@ class CouponController extends BaseController
$receiveType = $this->request->input("receive_type", 0); $receiveType = $this->request->input("receive_type", 0);
$ids = $this->request->input("ids", ''); $ids = $this->request->input("ids", '');
$res = $this->couponRecService->receive($userId,$receiveType,$ids); $res = $this->couponRecService->receive($userId,$receiveType,$ids);
return $this->success($res);
if(!empty($res['success'])){
return $this->success(['text' => '红包领取成功,请到“我的-红包”中查看']);
}else{
throw new ErrorCodeException(ErrorCode::COUPON_RECEIVE_FAILURE);
}
} }
} }
Loading…
Cancel
Save