改进 判断

This commit is contained in:
iVampireSP.com 2022-09-09 17:28:43 +08:00
parent 0efb6ec0b7
commit 253b3f1be0
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132

View File

@ -46,7 +46,13 @@ public function destroy(Host $host)
if ($host->user_id == auth()->id()) {
if ($host->status == 'pending') {
return $this->error('主机正在创建中,无法删除');
// 如果上次更新时间大于 5min
if (time() - strtotime($host->updated_at) > 300) {
$host->delete();
} else {
return $this->error('请等待 5 分钟后再试');
}
}
dispatch(new \App\Jobs\Remote\Host($host, 'delete'));