setter
parent
edbee2009c
commit
7cdca1b279
|
@ -493,6 +493,7 @@ class Coupon extends Base
|
||||||
return $this->json(4001, "商家已禁用");
|
return $this->json(4001, "商家已禁用");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$businessModel = $business["model"];
|
||||||
// 指定时间段内发布的优惠券个数
|
// 指定时间段内发布的优惠券个数
|
||||||
$TimeListModeReleaseCount = BusinessRepository::getInstance()
|
$TimeListModeReleaseCount = BusinessRepository::getInstance()
|
||||||
->getTimeListModeReleaseCount($business["code"],$business["time_limit_start"],$business["time_limit_end"]);
|
->getTimeListModeReleaseCount($business["code"],$business["time_limit_start"],$business["time_limit_end"]);
|
||||||
|
@ -510,11 +511,12 @@ class Coupon extends Base
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
if ($business['balance'] < $coupon->couponMain->deduction_money) {
|
$businessModel = BusinessModel::model_ordinary;
|
||||||
return $this->json(4001, "商家余额不足");
|
}
|
||||||
}
|
|
||||||
|
if ($business['balance'] < $coupon->couponMain->deduction_money) {
|
||||||
|
return $this->json(4001, "商家余额不足");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$deductionMoney = $coupon->couponMain->deduction_money;
|
$deductionMoney = $coupon->couponMain->deduction_money;
|
||||||
|
|
||||||
|
@ -646,26 +648,16 @@ class Coupon extends Base
|
||||||
Deduction::create($deductionData);
|
Deduction::create($deductionData);
|
||||||
|
|
||||||
|
|
||||||
//4. 商家扣钱 普通商家才扣钱 否则不扣钱
|
//4. 商家扣钱 所有模式商家都要扣钱
|
||||||
if(
|
$businessSaveData = [
|
||||||
$business["model"] == BusinessModel::model_ordinary
|
"balance" => Db::raw("balance - " . $deductionMoney,),
|
||||||
||
|
];
|
||||||
(
|
//是否要变更模式
|
||||||
$business["model"] == BusinessModel::model_time_limit
|
if ($businessModel == BusinessModel::model_ordinary) {
|
||||||
&&
|
$businessSaveData["model"] = BusinessModel::model_ordinary;
|
||||||
(
|
|
||||||
strtotime($business["time_limit_end"]) < $time
|
|
||||||
||
|
|
||||||
$TimeListModeReleaseCount >= $business["time_limit_release_count"]
|
|
||||||
)
|
|
||||||
)
|
|
||||||
){
|
|
||||||
|
|
||||||
$business->save([
|
|
||||||
"balance" => Db::raw("balance - " . $deductionMoney,),
|
|
||||||
"model" => BusinessModel::model_ordinary
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
$business->save($businessSaveData);
|
||||||
|
|
||||||
|
|
||||||
$payment = WechatPay::getInstance();
|
$payment = WechatPay::getInstance();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue