Jing Li 2024-04-10 12:58:16 +08:00
parent 3d403653a5
commit 547f0796ba
1 changed files with 2 additions and 1 deletions

View File

@ -64,6 +64,7 @@ class WormReportCommand extends Command
$this->info('==================================');
$this->info('尝试更新设备状态...');
$realTimeData = $client->realTimeData($devices->pluck('sn')->all());
foreach ($realTimeData as $item) {
foreach ($devices as $device) {
if ($item['deviceAddr'] != $device->sn) {
@ -71,7 +72,7 @@ class WormReportCommand extends Command
}
// 更新设备状态
$device->update([
'state' => $item['status'] === 'online' ? DeviceStatus::Online : DeviceStatus::Offline,
'status' => $item['status'] === 'online' ? DeviceStatus::Online : DeviceStatus::Offline,
]);
}
}