改进 模块自动检查
This commit is contained in:
parent
112637b8fe
commit
efcbb571dc
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user