Update
parent
675acf05c6
commit
5ae2c261f3
|
|
@ -6,6 +6,7 @@ use App\Enums\DeviceType;
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
use App\Models\LinkosDeviceLog;
|
use App\Models\LinkosDeviceLog;
|
||||||
use App\Services\LinkosDeviceLogService;
|
use App\Services\LinkosDeviceLogService;
|
||||||
|
use Carbon\Carbon;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
|
|
||||||
class LinkosDeviceLogArchiveCommand extends 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;
|
return Command::SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue