cleaned up GetStructuresCommand

This commit is contained in:
2021-01-10 23:58:42 +09:00
parent c00324a03c
commit 66dbdef629
2 changed files with 7 additions and 90 deletions

View File

@@ -17,6 +17,8 @@ use App\Jobs\ProcessStructureJob;
//Models
use App\Models\Esi\EsiScope;
use App\Models\Esi\EsiToken;
use App\Models\Structure\Structure;
use App\Models\Structure\Service;
class GetStructuresCommand extends Command
{
@@ -102,8 +104,13 @@ class GetStructuresCommand extends Command
return null;
}
//Get the total number of pages of all the structures
$totalPages = $structures->pages;
//Truncate the structures and the structure services in order to prepare to put new structures in the database
Structure::truncate();
Service::truncate();
for($i = 1; $i <= $totalPages; $i++) {
ProcessStructureJob::dispatch($charId, $corpId, $currentPage)->onQueue('structures');
}