esi update for observers
This commit is contained in:
@@ -96,14 +96,14 @@ class MiningTaxesObservers extends Command
|
|||||||
$sHelper = new StructureHelper($config['primary'], $config['corporation']);
|
$sHelper = new StructureHelper($config['primary'], $config['corporation']);
|
||||||
|
|
||||||
//Get the structure name from the universe endpoint to store in the database
|
//Get the structure name from the universe endpoint to store in the database
|
||||||
$observerInfo = $sHelper->GetStructureInfo($observer->observer_id);
|
$observerName = $sHelper->GetStructureName($observer->observer_id);
|
||||||
|
|
||||||
Observer::updateOrInsert([
|
Observer::updateOrInsert([
|
||||||
'observer_id' => $observer->observer_id,
|
'observer_id' => $observer->observer_id,
|
||||||
], [
|
], [
|
||||||
'observer_id' => $observer->observer_id,
|
'observer_id' => $observer->observer_id,
|
||||||
'observer_type' => $observer->observer_type,
|
'observer_type' => $observer->observer_type,
|
||||||
'observer_name' => $observerInfo->name,
|
'observer_name' => $observerName,
|
||||||
'last_updated' => $observer->last_updated,
|
'last_updated' => $observer->last_updated,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,9 +87,23 @@ class StructureHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function GetStructureName($structureId) {
|
||||||
|
try {
|
||||||
|
$info = $this->esi->invoke('get', '/universe/structures/{structure_id}/', [
|
||||||
|
'structure_id' => $structureId,
|
||||||
|
]);
|
||||||
|
} catch(RequestFailedException $e) {
|
||||||
|
Log::warning("Failed to get structure information for structure with id " . $structureId);
|
||||||
|
Log::warning($e->getCode());
|
||||||
|
Log::warning($e->getMessage());
|
||||||
|
Log::warning($e->getEsiResponse());
|
||||||
|
$info = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $info->name;
|
||||||
|
}
|
||||||
|
|
||||||
public function GetStructureInfo($structureId) {
|
public function GetStructureInfo($structureId) {
|
||||||
//Declare some variables
|
|
||||||
$esiHelper = new Esi;
|
|
||||||
try {
|
try {
|
||||||
$info = $this->esi->invoke('get', '/universe/structures/{structure_id}/', [
|
$info = $this->esi->invoke('get', '/universe/structures/{structure_id}/', [
|
||||||
'structure_id' => $structureId,
|
'structure_id' => $structureId,
|
||||||
|
|||||||
Reference in New Issue
Block a user