updated solar system name functions in structure helper. added new functions to lookup helper.

This commit is contained in:
2020-05-10 17:04:08 -05:00
parent b01bb72c1d
commit 16f808ae53
2 changed files with 49 additions and 16 deletions

View File

@@ -16,6 +16,7 @@ use Log;
use App\Jobs\Library\JobHelper;
use Seat\Eseye\Exceptions\RequestFailedException;
use App\Library\Esi\Esi;
use App\Library\Lookups\LookupHelper;
//App Models
use App\Models\Jobs\JobProcessStructure;
@@ -50,8 +51,6 @@ class StructureHelper {
$this->esi = $esiHelper->SetupEsiAuthentication($token);
}
//Try to get the ESI data
try {
$structures = $this->esi->page($page)
@@ -90,6 +89,7 @@ class StructureHelper {
private function GetSolarSystemName($systemId) {
//Declare some variables
$esiHelper = new Esi;
$lookup = new LookupHelper;
if($this->esi == null) {
//Get the refresh token
@@ -97,19 +97,11 @@ class StructureHelper {
//Setup the esi authentication container
$this->esi = $esiHelper->SetupEsiAuthentication($token);
}
//Attempt to get the solar system name from ESI
try {
$solar = $this->esi->invoke('get', '/universe/systems/{system_id}/', [
'system_id' => $systemId,
]);
} catch(RequestFailedException $e) {
$solar = null;
}
$solar = $lookup->SystemIdToName($systemId);
if($solar != null) {
return $solar->name;
return $solar;
} else {
return null;
}