dev
Jing Li 2022-10-25 10:16:11 +08:00
parent 675acf05c6
commit 5ae2c261f3
1 changed files with 16 additions and 0 deletions

View File

@ -6,6 +6,7 @@ use App\Enums\DeviceType;
use App\Models\Device;
use App\Models\LinkosDeviceLog;
use App\Services\LinkosDeviceLogService;
use Carbon\Carbon;
use Illuminate\Console\Command;
class LinkosDeviceLogArchiveCommand extends Command
@ -53,6 +54,21 @@ class LinkosDeviceLogArchiveCommand extends Command
}
});
$now = now();
$date = Carbon::parse('2022-06-01');
while ($date->lt($now)) {
foreach ($devices as $device) {
match ($device->type) {
DeviceType::Soil => $linkosDeviceLogService->handleSoilMonitoringDailyLog($device, $date),
DeviceType::Meteorological => $linkosDeviceLogService->handleMeteorologicalMonitoringDailyLog($device, $date),
DeviceType::WaterQuality => $linkosDeviceLogService->handleWaterQualityMonitoringDailyLog($device, $date),
};
}
$date->addDay();
}
return Command::SUCCESS;
}
}