sysUrl = env('sys_url', ''); } /** * Execute the console command. */ public function handle() { // 获取所有设备信息 $data = CameraApiService::query()->getCameraStatus(); if ($data && isset($data['body']['list'])) { $list = $data['body']['list']; // 通过设备信息获取设备状态 foreach ($list as $key => $item) { $ip = $item['camera_ip']; try { $statusBool = CameraDeviceService::query($ip)->getStatus(); } catch (\Exception $e) { $statusBool = false; } $list[$key]['status'] = $statusBool ? 1 : 0; } // 返回告诉设备状态情况 CameraApiService::query()->putCameraStatus(['list' => $list]); echo 'SUCCESS'; } echo 'empty'; exit(); } }