filename = $filename; $this->branchId = $branchId; } public function handle(): void { $path = storage_path($this->filename); if (!file_exists($path)) { Log::error("❌ SQLite 檔案不存在: {$path}"); return; } $user = \App\Models\User::find(2); $token = $user->api_plain_token; $branches = $this->branchId ? Branch::where('id', $this->branchId)->where('enabled', true)->get() : Branch::where('enabled', true)->cursor(); foreach ($branches as $branch) { $client = new ApiClient($token, $branch->external_ip); $response = $client->upload('/api/upload-sqlite', ['file' => $path]); if ($response->successful()) { Log::info("✅ 檔案 {$this->filename} 傳送成功"); } else { Log::error("❌ 傳送失敗:HTTP {$response->status()}"); Log::error($response->body()); } } } }