moon admin controller

This commit is contained in:
2019-05-05 20:57:13 -05:00
parent 11f038f601
commit f5363e86fb
2 changed files with 32 additions and 1 deletions

View File

@@ -182,6 +182,8 @@ class MoonsAdminController extends Controller
$contact = ''; $contact = '';
$paid = ''; $paid = '';
$rentalEnd = ''; $rentalEnd = '';
$renter = '';
$ticker = '';
//Setup calls to the MoonCalc class //Setup calls to the MoonCalc class
$moonCalc = new MoonCalc(); $moonCalc = new MoonCalc();
@@ -210,6 +212,11 @@ class MoonsAdminController extends Controller
//Set the contact info //Set the contact info
$contact = 'None'; $contact = 'None';
//Set the renter info
$renter = 'None';
$ticker = 'N/A';
} else { } else {
//If we find a rental record, mark the moon as whether it's paid or not //If we find a rental record, mark the moon as whether it's paid or not
$paid = $rental->Paid; $paid = $rental->Paid;
@@ -220,6 +227,11 @@ class MoonsAdminController extends Controller
//Set the contact name //Set the contact name
$contact = $lookup->CharacterName($rental->Contact); $contact = $lookup->CharacterName($rental->Contact);
//Set up the renter whether it's W4RP or another corporation
$corpId = $lookup->LookupCorporationId($contact);
$allianceId = $lookup->LookupCorporation($corpId);
$ticker = $lookup->LookupAllianceTicker($allianceId);
} }
//Set the color for the table //Set the color for the table
@@ -241,11 +253,12 @@ class MoonsAdminController extends Controller
'StructureName' => $moon->StructureName, 'StructureName' => $moon->StructureName,
'AlliancePrice' => $price['alliance'], 'AlliancePrice' => $price['alliance'],
'OutOfAlliancePrice' => $price['outofalliance'], 'OutOfAlliancePrice' => $price['outofalliance'],
'Renter' => $moon->RentalCorp, 'Renter' => $ticker,
'RentalEnd' => $rentalEnd, 'RentalEnd' => $rentalEnd,
'RowColor' => $color, 'RowColor' => $color,
'Paid' => $paid, 'Paid' => $paid,
'Contact' => $contact, 'Contact' => $contact,
'Renter' => $renter,
]); ]);
} }

View File

@@ -213,6 +213,24 @@ class LookupHelper {
} }
} }
public function LookupAllianceTicker($allianceId) {
//Get the configuration for ESI from the environmental variable
$config = config('esi');
//Setup a new ESI container
$esi = new Eseye();
try {
$alliance = $esi->invoke('get', '/alliances/{alliance_id}/', [
'alliance_id' => $allianceId,
]);
} catch(\Seat\Eseye\Exceptions\RequestFailedException $e){
return $e->getEsiResponse();
}
return $alliance->ticker;
}
//Update the character lookup table as often as necessary //Update the character lookup table as often as necessary
public function UpdateLookupCharacter() { public function UpdateLookupCharacter() {
//Create a new ESI container //Create a new ESI container