dev
Jing Li 2023-08-29 20:58:09 +08:00
parent 644b37da28
commit fe42931606
1 changed files with 8 additions and 8 deletions

View File

@ -137,14 +137,14 @@ class DeviceLogSyncCommand extends Command
case DeviceType::InsectSexLure: case DeviceType::InsectSexLure:
$data = $httpClient->getWormPhotos($device->sn, $now->copy()->subHours(24), $now); $data = $httpClient->getWormPhotos($device->sn, $now->copy()->subHours(24), $now);
foreach ($data['imgUrl'] as $item) { // foreach ($data['imgUrl'] as $item) {
WormPhoto::firstOrCreate([ // WormPhoto::firstOrCreate([
'device_id' => $device->id, // 'device_id' => $device->id,
'uploaded_at' => $item['time'], // 'uploaded_at' => $item['time'],
], [ // ], [
'url' => $item['url'], // 'url' => $item['url'],
]); // ]);
} // }
$device->update([ $device->update([
'status' => count($data['imgUrl'] ?? []) > 0 ? DeviceStatus::Online : DeviceStatus::Offline, 'status' => count($data['imgUrl'] ?? []) > 0 ? DeviceStatus::Online : DeviceStatus::Offline,