From 45129f95cb26a02d00bbaf40b7a9e7da374586dc Mon Sep 17 00:00:00 2001 From: "iVampireSP.com" Date: Fri, 13 Jan 2023 18:04:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Jobs/CheckHostIfExistsOnModuleJob.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Jobs/CheckHostIfExistsOnModuleJob.php b/app/Jobs/CheckHostIfExistsOnModuleJob.php index be4b20f..2c442bd 100644 --- a/app/Jobs/CheckHostIfExistsOnModuleJob.php +++ b/app/Jobs/CheckHostIfExistsOnModuleJob.php @@ -42,7 +42,12 @@ public function handle(): void $response = $host->module->http()->get('hosts/' . $host->id); - if ($response->status() === 404) { + $status = $response->status(); + + if ($status === 200) { + // 更新主机 + $host->update($response->json()); + } else if ($status === 404) { Log::warning($host->module->name . ' ' . $host->name . ' ' . $host->id . ' 不存在,删除。'); dispatch(new Module\HostJob($host, 'delete')); }