diff --git a/app/Jobs/Remote/FetchModule.php b/app/Jobs/Remote/FetchModule.php index 4de38d5..d59621d 100644 --- a/app/Jobs/Remote/FetchModule.php +++ b/app/Jobs/Remote/FetchModule.php @@ -34,7 +34,7 @@ public function __construct() public function handle() { // - Module::whereNotNull('url')->chunk(100, function ($modules) { + Module::whereNotNull('url')->chunk(100, function ($modules) { $servers = []; foreach ($modules as $module) { @@ -49,6 +49,7 @@ public function handle() // 只保留 name, status $servers = array_merge($servers, array_map(function ($server) use ($module) { return [ + 'module_id' => $module->id, 'module_name' => $module->name, 'name' => $server['name'], 'status' => $server['status'], @@ -63,8 +64,12 @@ public function handle() } } - // Cache servers - Cache::put('servers', $servers, now()->addMinutes(10)); + // if local + if (config('app.env') === 'local') { + Cache::forever('servers', $servers); + } else { + Cache::put('servers', $servers, now()->addMinutes(10)); + } }); } }