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