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:
$data = $httpClient->getWormPhotos($device->sn, $now->copy()->subHours(24), $now);
foreach ($data['imgUrl'] as $item) {
WormPhoto::firstOrCreate([
'device_id' => $device->id,
'uploaded_at' => $item['time'],
], [
'url' => $item['url'],
]);
}
// foreach ($data['imgUrl'] as $item) {
// WormPhoto::firstOrCreate([
// 'device_id' => $device->id,
// 'uploaded_at' => $item['time'],
// ], [
// 'url' => $item['url'],
// ]);
// }
$device->update([
'status' => count($data['imgUrl'] ?? []) > 0 ? DeviceStatus::Online : DeviceStatus::Offline,