main
Jing Li 2024-06-03 20:09:01 +08:00
parent f0f78aa038
commit c4d4f6fc37
1 changed files with 23 additions and 18 deletions

View File

@ -61,6 +61,7 @@ class DeviceLogSyncCommand extends Command
/** @var \Illuminate\Database\Eloquent\Collection */ /** @var \Illuminate\Database\Eloquent\Collection */
$devices = Device::with(['project']) $devices = Device::with(['project'])
->where('sn', 'CB15D3716349AEA2')
->supplierBy("device-supplier-biang") ->supplierBy("device-supplier-biang")
->whereIn('status', [DeviceStatus::Online, DeviceStatus::Offline]) ->whereIn('status', [DeviceStatus::Online, DeviceStatus::Offline])
->get(); ->get();
@ -157,6 +158,7 @@ class DeviceLogSyncCommand extends Command
} }
foreach ($data['imgUrl'] as $item) { foreach ($data['imgUrl'] as $item) {
try {
// 下载图片 // 下载图片
$name = md5($item['url']); $name = md5($item['url']);
if ($ext = pathinfo($item['url'], PATHINFO_EXTENSION)) { if ($ext = pathinfo($item['url'], PATHINFO_EXTENSION)) {
@ -176,6 +178,9 @@ class DeviceLogSyncCommand extends Command
], [ ], [
'url' => $path, 'url' => $path,
]); ]);
} catch (Throwable $e) {
report($e);
}
} }
$device->update([ $device->update([