From 3000277aa8486c9fc821756acbee199f332fff2e Mon Sep 17 00:00:00 2001 From: wangxinglong <2371974647@qq.com> Date: Mon, 20 Dec 2021 16:13:30 +0800 Subject: [PATCH] setter --- app/controller/api/Coupon.php | 14 ++++++++++++++ app/controller/manager/Coupon.php | 3 +++ 2 files changed, 17 insertions(+) diff --git a/app/controller/api/Coupon.php b/app/controller/api/Coupon.php index 9877639..f5a592a 100644 --- a/app/controller/api/Coupon.php +++ b/app/controller/api/Coupon.php @@ -223,6 +223,13 @@ class Coupon extends Base //执行领取 开启锁 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 { //检查优惠券状态 @@ -370,6 +377,10 @@ class Coupon extends Base return $this->json(4001, "商家不存在"); } + if($business->enable != BusinessModel::COMMON_OFF){ + return $this->json(4001, "商家已禁用"); + } + if($business->balance < $coupon->couponMain->deduction_money){ return $this->json(4001, "商家余额不足"); } @@ -520,6 +531,9 @@ class Coupon extends Base if (!isset($account->business) || empty($account->business)) { return $this->json(4001, "商家信息错误"); } + if($account->business->enable != BusinessModel::COMMON_OFF){ + return $this->json(4001, "商家已禁用"); + } $data = input(); Config::load("extra/distribution_proportion","distribution_proportion"); diff --git a/app/controller/manager/Coupon.php b/app/controller/manager/Coupon.php index 2d16312..60d668a 100644 --- a/app/controller/manager/Coupon.php +++ b/app/controller/manager/Coupon.php @@ -195,6 +195,9 @@ class Coupon extends Base if (empty($business)) { return $this->json(4001, '商家不存在'); } + if($business->enable != BusinessModel::COMMON_OFF){ + return $this->json(4001, "商家已禁用"); + } $validate = new CouponRelease(); //普通商家要验证扣除金额 if (!$validate->scene($business["model"] ==BusinessModel::model_ordinary?"ordinary":"")->check($data)) {