observer update and invoices creation

This commit is contained in:
2021-03-21 21:33:34 +09:00
parent 12cd0c7d74
commit c2d06472e3
6 changed files with 28 additions and 8 deletions
@@ -80,7 +80,24 @@ class MiningTaxesInvoicesNew extends Command
* From the list of character ids, create an array of mains and alts to group together.
*/
foreach($charIds as $charId) {
$invoice = array();
$ores = array();
$totalPrice = 0.00;
$body = null;
$mainId = null;
//Determine if this character is an alt of someone else
$foundAlt = UserAlt::where([
'character_id' => $charId,
])->get();
if($foundAlt > 0) {
$mainId = $foundAlt->main_id;
} else {
$mainId = $charId;
}
}
//Set the task as stopped
@@ -12,6 +12,7 @@ use Seat\Eseye\Exceptions\RequestFailedException;
use App\Library\Esi\Esi;
use App\Library\Helpers\LookupHelper;
use Commands\Library\CommandHelper;
use App\Library\Helpers\StructureHelper;
//App Models
use App\Models\MiningTax\Observer;
@@ -91,12 +92,18 @@ class MiningTaxesObservers extends Command
//Run through the mining observers, and add them to the database
foreach($resp as $observer) {
//Declare the structure helper
$sHelper = new StructureHelper($config['primary'], $config['corporation'], $refreshToken);
//Get the structure name from the universe endpoint to store in the database
$observerInfo = $sHelper->GetStructureInfo($observer->observer_id);
Observer::updateOrInsert([
'observer_id' => $observer->observer_id,
], [
'observer_id' => $observer->observer_id,
'observer_type' => $observer->observer_type,
'observer_name' => $observerInfo->name,
'last_updated' => $observer->last_updated,
]);
}