fetch mining taxes ledgers job

This commit is contained in:
2021-02-22 19:47:57 +09:00
parent 27a9715aa4
commit c95f6835ca
2 changed files with 14 additions and 2 deletions

View File

@@ -9,6 +9,9 @@ use Log;
//Application Library
use Commands\Library\CommandHelper;
//Models
use App\Models\MiningTax\Observer;
//Jobs
use App\Jobs\Commands\MiningTaxes\FetchMiningTaxesLedgersJob;
@@ -50,7 +53,16 @@ class MiningTaxesLedgers extends Command
//Set the task as started
$task->SetStartStatus();
FetchMiningTaxesLedgersJob::dispatch()->onQueue('miningtaxes');
//Get the site configuration which holds some data we need
$config = config('esi');
//Get the observers from the database
$observers = Observer::all();
//For each of the observers, send a job to fetch the mining ledger
foreach($observers as $obs) {
//Dispatch the mining taxes ledger jobs
FetchMiningTaxesLedgersJob::dispatch($config['corporation'], $obs->observer_id)->onQueue('miningtaxes');
}
//Return 0
return 0;

View File

@@ -104,7 +104,7 @@ class MiningTaxesObservers extends Command
/**
* Cleanup stale data that hasn't been updated in at least 1 week.
*/
$date = Carbon::now()->subDay(7);
$date = Carbon::now()->subMonths(2);
Observer::where('last_updated', '<', $date)->delete();