fetchminingtaxesobservers

This commit is contained in:
2021-05-18 18:08:46 +09:00
parent c341d21bbe
commit 6c90f9f642
2 changed files with 8 additions and 19 deletions

View File

@@ -13,6 +13,7 @@ use Carbon\Carbon;
//Application Library
use Seat\Eseye\Exceptions\RequestFailedException;
use App\Library\Esi\Esi;
use App\Library\Helpers\LookupHelper;
use App\Library\Helpers\StructureHelper;
//Models
@@ -103,7 +104,7 @@ class FetchMiningTaxesObservers implements ShouldQueue
'observer_name' => $structureInfo->name,
'last_updated' => $observer->last_updated,
'solar_system_id' => $structureInfo->solar_system_id,
'solar_system_name' => $sHelper->GetSolarSystemName($structureInfo->solar_system_id),
'solar_system_name' => $lookup->SystemIdToName($structureInfo->solar_system_id),
]);
} else {
//Add a new observer into the observer table
@@ -113,7 +114,7 @@ class FetchMiningTaxesObservers implements ShouldQueue
$newObs->observer_name = $structureInfo->name;
$newObs->last_updated = $observer->last_updated;
$newObs->solar_system_id = $structureInfo->solar_system_id;
$newObs->solar_system_name = $sHelper->GetSolarSystemName($structureInfo->solar_system_id);
$newObs->solar_system_name = $lookup->SystemIdToName($structureInfo->solar_system_id);
$newObs->save();
}
}

View File

@@ -14,7 +14,7 @@ use Log;
use App\Jobs\Library\JobHelper;
use Seat\Eseye\Exceptions\RequestFailedException;
use App\Library\Esi\Esi;
use App\Library\Lookups\LookupHelper;
use App\Library\Helpers\LookupHelper;
//App Models
use App\Models\Jobs\JobStatus;
@@ -73,19 +73,6 @@ class StructureHelper {
}
}
public function GetSolarSystemName($systemId) {
//Declare some variables
$lookup = new LookupHelper;
$solar = $lookup->SystemIdToName($systemId);
if($solar != null) {
return $solar;
} else {
return null;
}
}
public function GetStructureName($structureId) {
try {
$info = $this->esi->invoke('get', '/universe/structures/{structure_id}/', [
@@ -248,12 +235,13 @@ class StructureHelper {
}
private function SaveNewStructure($structure, $info) {
//Declare helper variable needed
$lookup = new LookupHelper;
if(isset($info->solar_system_id)) {
$solarName = $this->GetSolarSystemName($info->solar_system_id);
$solarName = $lookup->SolarSystemIdToName($info->solar_system_id);
} else {
Log::critical("Couldn't get solar system name for structure " . $structure->structure_id);
Log::critical("Check access lists.");
Log::critical("Couldn't get solar system name for structure " . $structure->structure_id . " in SaveNewStructure in StructureHelper.php");
$solarName = null;
}