From cb671bae45c8244ecd79a04e9b3d984e4bc03cf8 Mon Sep 17 00:00:00 2001 From: wangxinglong <2371974647@qq.com> Date: Wed, 30 Mar 2022 18:11:53 +0800 Subject: [PATCH] setter --- app/controller/api/Coupon.php | 38 +++++++++++++++++-------------- app/controller/manager/Coupon.php | 36 +++++++++++++++-------------- 2 files changed, 40 insertions(+), 34 deletions(-) diff --git a/app/controller/api/Coupon.php b/app/controller/api/Coupon.php index cf8550a..b6d5610 100644 --- a/app/controller/api/Coupon.php +++ b/app/controller/api/Coupon.php @@ -513,7 +513,7 @@ class Coupon extends Base ) { $businessModel = BusinessModel::model_ordinary; } - + if ($business['balance'] < $coupon->couponMain->deduction_money) { return $this->json(4001, "商家余额不足"); } @@ -1023,22 +1023,26 @@ class Coupon extends Base //未领取的优惠券 $NotClaimedMoney = CouponRepository::getInstance()->getBusinessNotClaimedCoupon($account->business["code"]); - if( - $account->business["model"] == BusinessModel::model_ordinary - || - ( - $account->business["model"] == BusinessModel::model_time_limit - && - ( - (strtotime($account->business["time_limit_end"]) < $time) - || - ($TimeListModeReleaseCount >= $account->business["time_limit_release_count"]) - ) - ) - ) { - if ($account->business["balance"] < ($totalMoney + $NotClaimedMoney)) { - return $this->json(4001, '商家余额不足'); - } +// if( +// $account->business["model"] == BusinessModel::model_ordinary +// || +// ( +// $account->business["model"] == BusinessModel::model_time_limit +// && +// ( +// (strtotime($account->business["time_limit_end"]) < $time) +// || +// ($TimeListModeReleaseCount >= $account->business["time_limit_release_count"]) +// ) +// ) +// ) { +// if ($account->business["balance"] < ($totalMoney + $NotClaimedMoney)) { +// return $this->json(4001, '商家余额不足'); +// } +// } + + if ($account->business["balance"] < ($totalMoney + $NotClaimedMoney)) { + return $this->json(4001, '商家余额不足'); } Db::startTrans(); diff --git a/app/controller/manager/Coupon.php b/app/controller/manager/Coupon.php index 0c2d33d..e3a64ee 100644 --- a/app/controller/manager/Coupon.php +++ b/app/controller/manager/Coupon.php @@ -326,25 +326,27 @@ class Coupon extends Base //未领取的优惠券 $NotClaimedMoney = CouponRepository::getInstance()->getBusinessNotClaimedCoupon($business["code"]); - if( - $business["model"] == BusinessModel::model_ordinary - || - ( - $business["model"] == BusinessModel::model_time_limit - && - ( - strtotime($business["time_limit_end"]) < $time - || - $TimeListModeReleaseCount >= $business["time_limit_release_count"] - ) - ) - ){ - if ($business["balance"] < ($totalMoney + $NotClaimedMoney)) { - return $this->json(4001, '商家余额不足'); - } +// if( +// $business["model"] == BusinessModel::model_ordinary +// || +// ( +// $business["model"] == BusinessModel::model_time_limit +// && +// ( +// strtotime($business["time_limit_end"]) < $time +// || +// $TimeListModeReleaseCount >= $business["time_limit_release_count"] +// ) +// ) +// ){ +// if ($business["balance"] < ($totalMoney + $NotClaimedMoney)) { +// return $this->json(4001, '商家余额不足'); +// } +// } + if ($business["balance"] < ($totalMoney + $NotClaimedMoney)) { + return $this->json(4001, '商家余额不足'); } - $date = date("Y-m-d H:i:s"); $data['create_time'] = $date; $data['update_time'] = $date;