如果时间大于 5 分钟,不满 1 小时,则按 1 小时扣费
This commit is contained in:
parent
b3ea002897
commit
b6a87a81c4
@ -48,13 +48,18 @@ public function destroy(HostRequest $request, Host $host): JsonResponse
|
||||
|
||||
if ($host->status == 'pending') {
|
||||
// 如果上次更新时间大于 5min
|
||||
if (time() - strtotime($host->updated_at) > 300) {
|
||||
if ($host->updated_at->diffInMinutes(now()) > 5) {
|
||||
$host->delete();
|
||||
} else {
|
||||
return $this->error('请等待 5 分钟后再试');
|
||||
}
|
||||
}
|
||||
|
||||
// 如果时间大于 5 分钟,不满 1 小时
|
||||
if (now()->diffInMinutes($host->updated_at) > 5 && now()->diffInMinutes($host->updated_at) < 60) {
|
||||
$host->cost();
|
||||
}
|
||||
|
||||
dispatch(new \App\Jobs\Module\Host($host, 'delete'));
|
||||
|
||||
return $this->deleted($host);
|
||||
|
Loading…
Reference in New Issue
Block a user