From 253b3f1be0b8facb3ef915c8ffa18b481c84ce55 Mon Sep 17 00:00:00 2001 From: "iVampireSP.com" Date: Fri, 9 Sep 2022 17:28:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=20=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/User/HostController.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/User/HostController.php b/app/Http/Controllers/User/HostController.php index f897f1a..8538874 100644 --- a/app/Http/Controllers/User/HostController.php +++ b/app/Http/Controllers/User/HostController.php @@ -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'));