Fix
parent
b46e1ff1c6
commit
53c44e8165
|
|
@ -64,18 +64,14 @@ class MonitorDeviceHealthCommand extends Command
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($result['data'] as $item) {
|
foreach ($result['data'] as $item) {
|
||||||
$device = Device::supplierBy('device-supplier-yidong')
|
Device::where('sn', $item['deviceId'])
|
||||||
|
->where('supplier_key', 'device-supplier-yidong')
|
||||||
->where('type', DeviceType::Monitor)
|
->where('type', DeviceType::Monitor)
|
||||||
->where('sn', $item['deviceId'])
|
->whereIn('status', [DeviceStatus::Online, DeviceStatus::Offline])
|
||||||
->first();
|
->update([
|
||||||
|
'status' => $item['deviceStatus'] === 1 ? DeviceStatus::Online : DeviceStatus::Offline,
|
||||||
if (! in_array($device?->status, [DeviceStatus::Online, DeviceStatus::Offline])) {
|
'updated_at' => now(),
|
||||||
continue;
|
]);
|
||||||
}
|
|
||||||
|
|
||||||
$device->update([
|
|
||||||
'status' => $item['deviceStatus'] === 1 ? DeviceStatus::Online : DeviceStatus::Offline,
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$page++;
|
$page++;
|
||||||
|
|
@ -96,31 +92,23 @@ class MonitorDeviceHealthCommand extends Command
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
$devices = Device::supplierBy('device-supplier-dianxin')
|
foreach ($result['data'] as $item) {
|
||||||
->where('type', DeviceType::Monitor)
|
Device::where('sn', $item['channelcode'])
|
||||||
->whereIn('status', [DeviceStatus::Online, DeviceStatus::Offline])
|
->where('supplier_key', 'device-supplier-dianxin')
|
||||||
->get();
|
->where('type', DeviceType::Monitor)
|
||||||
|
->whereIn('status', [DeviceStatus::Online, DeviceStatus::Offline])
|
||||||
foreach ($devices as $device) {
|
->update([
|
||||||
foreach ($result['data'] as $item) {
|
'extends' => json_encode([
|
||||||
if ($device->sn !== $item['channelcode']) {
|
'ip' => '',
|
||||||
continue;
|
'port' => '',
|
||||||
}
|
'username' => '',
|
||||||
|
'password' => '',
|
||||||
$device->update([
|
'passage' => $item['citId'],
|
||||||
'extends' => [
|
'rtsp_url' => '',
|
||||||
'ip' => '',
|
]),
|
||||||
'port' => '',
|
'status' => $item['channelstatus'] === 1 ? DeviceStatus::Online : DeviceStatus::Offline,
|
||||||
'username' => '',
|
'updated_at' => now(),
|
||||||
'password' => '',
|
]);
|
||||||
'passage' => $item['citId'],
|
|
||||||
'rtsp_url' => '',
|
|
||||||
],
|
|
||||||
'status' => $item['channelstatus'] === 1 ? DeviceStatus::Online : DeviceStatus::Offline,
|
|
||||||
]);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ class HttpClient
|
||||||
'headers' => $headers,
|
'headers' => $headers,
|
||||||
'json' => $data,
|
'json' => $data,
|
||||||
]);
|
]);
|
||||||
} catch (YiDongException $e) {
|
} catch (QlyException $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue