改进 模块自动检查

This commit is contained in:
iVampireSP.com 2022-11-23 03:16:23 +00:00
parent 112637b8fe
commit efcbb571dc

View File

@ -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