This commit is contained in:
2019-05-30 23:53:18 -05:00
parent 545480056a
commit a914dbc469
2 changed files with 25 additions and 26 deletions

View File

@@ -69,5 +69,8 @@ class ProcessStructureJob implements ShouldQueue
$sHelper = new StructureHelper($this->charId, $this->corpId);
$sHelper->ProcessStructure($this->structure);
//After the job is completed, delete the job
$this->delete();
}
}

View File

@@ -42,6 +42,28 @@ class StructureHelper {
$this->corpId = $corp;
}
public function GetStructuresByPage($page) {
// Disable all caching by setting the NullCache as the
// preferred cache handler. By default, Eseye will use the
// FileCache.
$configuration = Configuration::getInstance();
$configuration->cache = NullCache::class;
//Setup the esi authentication container
$config = config('esi');
//Get the refresh token from the database
$token = EsiToken::where(['character_id' => $charId])->get(['refresh_token']);
$authentication = new EsiAuthentication([
'client_id' => $config['client_id'],
'secret' => $config['secret'],
'refresh_token' => $token[0]->refresh_token,
]);
//Setup the ESI variable
$esi = new Eseye($authentication);
}
public function ProcessStructure($structure) {
//Setup the esi authentication container
$config = config('esi');
@@ -67,32 +89,6 @@ class StructureHelper {
}
public function GetListOfStructures() {
//Setup the esi authentication container
$config = config('esi');
//Get the refresh token from the database
$token = EsiToken::where(['character_id' => $this->charId])->get(['refresh_token']);
$authentication = new EsiAuthentication([
'client_id' => $config['client_id'],
'secret' => $config['secret'],
'refresh_token' => $token[0]->refresh_token,
]);
$esi = new Eseye($authentication);
try {
$structures = $esi->page($this->page)
->invoke('get', '/corporations/{corporation_id}/structures/', [
'corporation_id' => $this->corpId,
]);
} catch (RequestFailedException $e) {
Log::critical("Failed to get structure list.");
$structures = null;
}
return $structures;
}
private function GetSolarSystemName($systemId) {
//Setup the esi authentication container
$config = config('esi');