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