master
wangxinglong 2022-03-31 15:13:57 +08:00
parent 97a97aa488
commit 45ba75a8a0
1 changed files with 17 additions and 1 deletions

View File

@ -168,6 +168,22 @@ class User extends Base
throw new ValidateException('用户无效!没有相关的商户信息记录');
}
$businessModel = $account->business["model"];
// 指定时间段内发布的签到券个数
$TimeListModeReleaseCount = BusinessRepository::getInstance()
->getTimeListModeReleaseCount($account->business["code"],$account->business["time_limit_start"],$account->business["time_limit_end"]);
if($account->business["model"] == Business::model_time_limit){
//如果到了时间 或者发布数量到达规定 更改商家模式
if( strtotime($account->business["time_limit_end"] ) < time()
||
(($TimeListModeReleaseCount + 1) >= $account->business["time_limit_release_count"])
){
$businessModel = Business::model_ordinary;
$account->business->save(["model"=> Business::model_ordinary]);
}
}
// 指定时间段内发布的签到券个数
$TimeListModeReleaseCount = BusinessRepository::getInstance()
->getTimeListModeReleaseCount($account->business["code"],$account->business["time_limit_start"],$account->business["time_limit_end"]);
@ -187,7 +203,7 @@ class User extends Base
'reason' => $account['business']['reason'],
'balance' => $account['business']['balance'],
'enable' => $account['business']['enable'],
'model' => $account['business']['model'],
'model' => $businessModel,
'time_limit_end' => $account['business']['time_limit_end'],
'time_limit_release_count' => $account['business']['time_limit_release_count'] - $TimeListModeReleaseCount,
// 商家优惠卷情况统计