assets and structure job modifications

This commit is contained in:
2019-05-28 22:50:43 -05:00
parent 1e43122c3d
commit f479a7066c
4 changed files with 206 additions and 103 deletions
+22 -24
View File
@@ -57,6 +57,10 @@ class GetStructures extends Command
//Add the entry into the jobs table saying the job is starting
$task->SetStartStatus();
//Declare some variables
$charId = 93738849;
$corpId = 98287666;
//ESI Scope Check
$esiHelper = new Esi();
$structureScope = $esiHelper->HaveEsiScope($charId, 'esi-universe.read_structures.v1');
@@ -84,32 +88,26 @@ class GetStructures extends Command
//Set our default total pages, and we will refresh this later
$totalPages = 1;
do {
try {
$structures = $esi->page($currentPage)
->invoke('get', '/corporations/{corporation_id}/structures/', [
'corporation_id' => 98287666,
]);
} catch (RequestFailedException $e) {
Log::critical("Failed to get structure list.");
return null;
}
try {
$structures = $esi->page($currentPage)
->invoke('get', '/corporations/{corporation_id}/structures/', [
'corporation_id' => $corpId,
]);
} catch (RequestFailedException $e) {
Log::critical("Failed to get structure list.");
return null;
}
//Set the total pages we need to cycle through
if($totalPages == 1) {
$totalPages = $structures->pages;
}
$totalPages = $structures->pages;
//Dispatch a job to get all of the structure information from ESI
foreach($structures as $structure) {
$job = new JobProcessStructure;
$job->charId = 93738489;
$job->corpId = 98287666;
$job->structure = $structure;
ProcessStructureJob::dispatch($job)->onQueue('default');
}
} while ($currentPage < $totalPages);
for($i = 1; $i <= $totalPages; $i++) {
$job = new JobProcessStructure;
$job->charId = $charId;
$job->corpId = $corpId;
$job->page = $i;
$job->esi = $esi;
ProcessStructureJob::dispatch($job)->onQueue('default');
}
//Mark the job as finished
$task->SetStopStatus();