master
wangxinglong 2021-12-20 16:13:30 +08:00
parent 2899c4b4bf
commit 3000277aa8
2 changed files with 17 additions and 0 deletions

View File

@ -223,6 +223,13 @@ class Coupon extends Base
//执行领取 开启锁 //执行领取 开启锁
return $q->with("business")->lock(true); return $q->with("business")->lock(true);
}); });
if(!isset($couponMain->business)||empty($couponMain->business)){
return $this->json(4001, "优惠券所属商家不存在");
}
if($couponMain->business->enable != BusinessModel::COMMON_OFF){
return $this->json(4001, "商家已禁用");
}
try { try {
//检查优惠券状态 //检查优惠券状态
@ -370,6 +377,10 @@ class Coupon extends Base
return $this->json(4001, "商家不存在"); return $this->json(4001, "商家不存在");
} }
if($business->enable != BusinessModel::COMMON_OFF){
return $this->json(4001, "商家已禁用");
}
if($business->balance < $coupon->couponMain->deduction_money){ if($business->balance < $coupon->couponMain->deduction_money){
return $this->json(4001, "商家余额不足"); return $this->json(4001, "商家余额不足");
} }
@ -520,6 +531,9 @@ class Coupon extends Base
if (!isset($account->business) || empty($account->business)) { if (!isset($account->business) || empty($account->business)) {
return $this->json(4001, "商家信息错误"); return $this->json(4001, "商家信息错误");
} }
if($account->business->enable != BusinessModel::COMMON_OFF){
return $this->json(4001, "商家已禁用");
}
$data = input(); $data = input();
Config::load("extra/distribution_proportion","distribution_proportion"); Config::load("extra/distribution_proportion","distribution_proportion");

View File

@ -195,6 +195,9 @@ class Coupon extends Base
if (empty($business)) { if (empty($business)) {
return $this->json(4001, '商家不存在'); return $this->json(4001, '商家不存在');
} }
if($business->enable != BusinessModel::COMMON_OFF){
return $this->json(4001, "商家已禁用");
}
$validate = new CouponRelease(); $validate = new CouponRelease();
//普通商家要验证扣除金额 //普通商家要验证扣除金额
if (!$validate->scene($business["model"] ==BusinessModel::model_ordinary?"ordinary":"")->check($data)) { if (!$validate->scene($business["model"] ==BusinessModel::model_ordinary?"ordinary":"")->check($data)) {