From efcbb571dca09de647fd0a381b25a1fe2ec438b3 Mon Sep 17 00:00:00 2001 From: "iVampireSP.com" Date: Wed, 23 Nov 2022 03:16:23 +0000 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=20=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Jobs/Module/FetchModule.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/Jobs/Module/FetchModule.php b/app/Jobs/Module/FetchModule.php index 9de1e04..0a692a6 100644 --- a/app/Jobs/Module/FetchModule.php +++ b/app/Jobs/Module/FetchModule.php @@ -45,7 +45,7 @@ public function handle() } // - Module::whereNotNull('url')->chunk(100, function ($modules) { + Module::where('status', '!=', 'maintenance')->whereNotNull('url')->chunk(100, function ($modules) { $servers = []; foreach ($modules as $module) { @@ -59,6 +59,14 @@ public function handle() } if ($response->successful()) { + + // 如果模块状态为 down,则更新为 up + if ($module->status === 'down') { + $module->update([ + 'status' => 'up' + ]); + } + $json = $response->json(); if (isset($json['data']['servers']) && is_array($json['data']['servers'])) { @@ -78,9 +86,7 @@ public function handle() broadcast(new ServerEvent($servers)); } - // $module->update([ - // 'data' => $response->json() - // ]); + } else { // if module return maintenance, then set module status to maintenance