master
wangxinglong 2022-03-30 17:22:07 +08:00
parent 48c3e9958b
commit edbee2009c
2 changed files with 32 additions and 11 deletions

View File

@ -938,11 +938,25 @@ class Coupon extends Base
];
//$usingRule = input("using_rule/a");
$businessModel = $account->business["model"];
// 指定时间段内发布的优惠券个数
$TimeListModeReleaseCount = BusinessRepository::getInstance()
->getTimeListModeReleaseCount($account->business["code"],$account->business["time_limit_start"],$account->business["time_limit_end"]);
$validate = new CouponRelease();
if($account->business["model"] == BusinessModel::model_time_limit){
//如果到了时间 或者发布数量到达规定 更改商家模式
if( strtotime($account->business["time_limit_end"] ) < $time
||
(($TimeListModeReleaseCount + 1) >= $account->business["time_limit_release_count"])
){
$businessModel = BusinessModel::model_ordinary;
}
}
$validate = new CouponRelease();
//普通商家要验证扣除金额
if (!$validate->scene(($account->business["model"] == BusinessModel::model_ordinary )? "ordinary" : "")->check($couponMain)) {
if (!$validate->scene(($businessModel == BusinessModel::model_ordinary )? "ordinary" : "")->check($couponMain)) {
return $this->json(4001, $validate->getError());
}
@ -1017,10 +1031,6 @@ class Coupon extends Base
//未领取的优惠券
$NotClaimedMoney = CouponRepository::getInstance()->getBusinessNotClaimedCoupon($account->business["code"]);
// 指定时间段内发布的优惠券个数
$TimeListModeReleaseCount = BusinessRepository::getInstance()
->getTimeListModeReleaseCount($account->business["code"],$account->business["time_limit_start"],$account->business["time_limit_end"]);
if(
$account->business["model"] == BusinessModel::model_ordinary
||

View File

@ -186,9 +186,24 @@ class Coupon extends Base
if($business->enable != BusinessModel::COMMON_OFF){
return $this->json(4001, "商家已禁用");
}
// 指定时间段内发布的优惠券个数
$TimeListModeReleaseCount = BusinessRepository::getInstance()
->getTimeListModeReleaseCount($business["code"],$business["time_limit_start"],$business["time_limit_end"]);
$businessModel = $business["model"];
if($business["model"] == BusinessModel::model_time_limit){
//如果到了时间 或者发布数量到达规定 更改商家模式
if( strtotime($business["time_limit_end"] ) < $time
||
(($TimeListModeReleaseCount) >= $business["time_limit_release_count"])
){
$businessModel = BusinessModel::model_ordinary;
}
}
$validate = new CouponRelease();
//普通商家要验证扣除金额
if (!$validate->scene(($business["model"] == BusinessModel::model_ordinary) ? "ordinary" : "")->check($data)) {
if (!$validate->scene(($businessModel == BusinessModel::model_ordinary) ? "ordinary" : "")->check($data)) {
return $this->json(4001, $validate->getError());
}
@ -311,10 +326,6 @@ class Coupon extends Base
//未领取的优惠券
$NotClaimedMoney = CouponRepository::getInstance()->getBusinessNotClaimedCoupon($business["code"]);
// 指定时间段内发布的优惠券个数
$TimeListModeReleaseCount = BusinessRepository::getInstance()
->getTimeListModeReleaseCount($business["code"],$business["time_limit_start"],$business["time_limit_end"]);
if(
$business["model"] == BusinessModel::model_ordinary
||