Update
parent
72f056cf04
commit
56226b84a6
|
|
@ -76,7 +76,7 @@ class DeviceLogSyncCommand extends Command
|
|||
});
|
||||
|
||||
try {
|
||||
(new BiAngDeviceLogService())->sync($device, $now);
|
||||
(new BiAngDeviceLogService())->sync($device, $now->copy());
|
||||
|
||||
$this->info('同步成功!');
|
||||
} catch (Throwable $e) {
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class BiAngDeviceLogService
|
|||
]);
|
||||
|
||||
$device->update([
|
||||
'status' => $syncTime->copy()->subMinutes(60)->lt($log->reported_at) ? DeviceStatus::Online : DeviceStatus::Offline,
|
||||
'status' => $syncTime->subMinutes(60)->lt($log->reported_at) ? DeviceStatus::Online : DeviceStatus::Offline,
|
||||
]);
|
||||
break;
|
||||
case DeviceType::Meteorological:
|
||||
|
|
@ -52,7 +52,7 @@ class BiAngDeviceLogService
|
|||
]);
|
||||
|
||||
$device->update([
|
||||
'status' => $syncTime->copy()->subMinutes(60)->lt($log->reported_at) ? DeviceStatus::Online : DeviceStatus::Offline,
|
||||
'status' => $syncTime->subMinutes(60)->lt($log->reported_at) ? DeviceStatus::Online : DeviceStatus::Offline,
|
||||
]);
|
||||
break;
|
||||
|
||||
|
|
@ -62,7 +62,7 @@ class BiAngDeviceLogService
|
|||
if ($data['status'] === 'online') {
|
||||
InsecticidalLampReport::updateOrCreate([
|
||||
'device_id' => $device->id,
|
||||
'reported_at' => $syncTime->copy()->startOfHour(),
|
||||
'reported_at' => $syncTime->startOfHour(),
|
||||
], [
|
||||
'battery_vol' => $data['vol'],
|
||||
'killed_num' => $data['dct'],
|
||||
|
|
|
|||
Loading…
Reference in New Issue