diff --git a/app/controller/api/User.php b/app/controller/api/User.php index c9e31b3..ce90ac8 100644 --- a/app/controller/api/User.php +++ b/app/controller/api/User.php @@ -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, // 商家优惠卷情况统计