master
wangxinglong 2022-03-30 18:11:53 +08:00
parent 7cdca1b279
commit cb671bae45
2 changed files with 40 additions and 34 deletions

View File

@ -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();

View File

@ -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;