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

View File

@@ -80,7 +80,24 @@ class MiningTaxesInvoicesNew extends Command
* From the list of character ids, create an array of mains and alts to group together. * From the list of character ids, create an array of mains and alts to group together.
*/ */
foreach($charIds as $charId) { 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 //Set the task as stopped

View File

@@ -12,6 +12,7 @@ use Seat\Eseye\Exceptions\RequestFailedException;
use App\Library\Esi\Esi; use App\Library\Esi\Esi;
use App\Library\Helpers\LookupHelper; use App\Library\Helpers\LookupHelper;
use Commands\Library\CommandHelper; use Commands\Library\CommandHelper;
use App\Library\Helpers\StructureHelper;
//App Models //App Models
use App\Models\MiningTax\Observer; use App\Models\MiningTax\Observer;
@@ -91,12 +92,18 @@ class MiningTaxesObservers extends Command
//Run through the mining observers, and add them to the database //Run through the mining observers, and add them to the database
foreach($resp as $observer) { 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::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,
'last_updated' => $observer->last_updated, 'last_updated' => $observer->last_updated,
]); ]);
} }

View File

@@ -5,6 +5,7 @@ namespace App\Http\Controllers\MiningTaxes;
//Internal Library //Internal Library
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use DB;
use Log; use Log;
use Carbon\Carbon; use Carbon\Carbon;
use Khill\Lavacharts\Lavacharts; use Khill\Lavacharts\Lavacharts;

View File

@@ -28,13 +28,6 @@ class ProcessSendEveMailJob implements ShouldQueue
{ {
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Timeout in seconds
* With new rate limiting, we shouldn't use this timeout
* @var int
*/
//public $timeout = 3600;
/** /**
* Retries * Retries
* With new rate limiting, we need a retry basis versus timeout basis * With new rate limiting, we need a retry basis versus timeout basis

View File

@@ -24,5 +24,6 @@ class Observer extends Model
'last_updated', 'last_updated',
'observer_id', 'observer_id',
'observer_type', 'observer_type',
'observer_name',
]; ];
} }

View File

@@ -41,6 +41,7 @@ class CreateMiningTaxTables extends Migration
$table->dateTime('last_updated'); $table->dateTime('last_updated');
$table->unsignedBigInteger('observer_id'); $table->unsignedBigInteger('observer_id');
$table->string('observer_type'); $table->string('observer_type');
$table->string('observer_name');
$table->timestamps(); $table->timestamps();
}); });
} }