123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- namespace App\Console\Commands;
- use App\Models\BimFile;
- use App\Models\Enums\BimFileConvertStatus;
- use App\Services\File\BimService;
- use Illuminate\Console\Command;
- class FetchBimInfo extends Command
- {
-
- protected $signature = 'lpc:fetch-bim-info {scope=1}';
-
- protected $description = 'fetch bim info from engine';
-
- public function handle()
- {
- $this->info('start to fetch bim info');
- $scopeDay = (int) $this->argument('scope');
- if ($scopeDay == 0) {
- $startDateTime = '';
- } else {
- $startDateTime = date_time_str(strtotime('-' . $scopeDay . 'days'));
- }
- $bimService = new BimService;
- BimFile::query()->createdAtStart($startDateTime)
- ->chunkById(50, function ($bimFiles) use ($bimService) {
- foreach ($bimFiles as $bimFile) {
- $bimFile = $bimService->storeBimInfo($bimFile);
- $this->info($bimFile->id . ' extra is ' . json_encode($bimFile->extra));
- }
- });
- }
- }
|