From a33d981dcc60a6cf7fe15b7223fb460c47bd9ca7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=9D=99?= Date: Fri, 12 May 2023 13:32:25 +0800 Subject: [PATCH] Fix --- app/Console/Commands/DeviceLogDailyReportCommand.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Console/Commands/DeviceLogDailyReportCommand.php b/app/Console/Commands/DeviceLogDailyReportCommand.php index 5c6c2f4..373d88d 100644 --- a/app/Console/Commands/DeviceLogDailyReportCommand.php +++ b/app/Console/Commands/DeviceLogDailyReportCommand.php @@ -76,7 +76,7 @@ class DeviceLogDailyReportCommand extends Command protected function createReportToLinkosMeteorologicalDevice(Device $device): void { $lastReportedAt = MeteorologicalDailyReport::where('device_id', $device->id)->latest('reported_at')->value('reported_at') - ?: MeteorologicalReport::where('device_id', $device->id)->latest('reported_at')->value('reported_at'); + ?: MeteorologicalReport::where('device_id', $device->id)->oldest('reported_at')->value('reported_at'); if ($lastReportedAt === null) { return; @@ -104,7 +104,7 @@ class DeviceLogDailyReportCommand extends Command protected function createReportToLinkosWaterQualityDevice(Device $device): void { $lastReportedAt = WaterQualityDailyReport::where('device_id', $device->id)->latest('reported_at')->value('reported_at') - ?: WaterQualityReport::where('device_id', $device->id)->latest('reported_at')->value('reported_at'); + ?: WaterQualityReport::where('device_id', $device->id)->oldest('reported_at')->value('reported_at'); if ($lastReportedAt === null) { return;