From 925b9739da78b3f0495976f57f3c6e7c955612fe Mon Sep 17 00:00:00 2001 From: drkthunder02 Date: Sun, 14 Feb 2021 00:46:15 +0900 Subject: [PATCH] job stuff --- app/Console/Commands/Data/Test.php | 1 + .../Commands/Finances/HoldingFinancesCommand.php | 16 ++-------------- .../Finances/ProcessWalletJournalJob.php | 5 ++--- app/Library/Finances/Helper/FinanceHelper.php | 9 +++------ 4 files changed, 8 insertions(+), 23 deletions(-) diff --git a/app/Console/Commands/Data/Test.php b/app/Console/Commands/Data/Test.php index fec709db4..961335847 100644 --- a/app/Console/Commands/Data/Test.php +++ b/app/Console/Commands/Data/Test.php @@ -58,6 +58,7 @@ class Test extends Command //Get the ESI Token $token = $esiHelper->GetRefreshToken($config['primary']); + dd($token); $esi = $esiHelper->SetupEsiAuthentication($token); try { diff --git a/app/Console/Commands/Finances/HoldingFinancesCommand.php b/app/Console/Commands/Finances/HoldingFinancesCommand.php index 774d05cff..0932d42f0 100644 --- a/app/Console/Commands/Finances/HoldingFinancesCommand.php +++ b/app/Console/Commands/Finances/HoldingFinancesCommand.php @@ -48,20 +48,8 @@ class HoldingFinancesCommand extends Command //Get the esi configuration $config = config('esi'); - //Get the total pages for the journal for the holding corporation - $pages = $finance->GetJournalPageCount(1, $config['primary']); - - //Dispatch a single job for each page to process - for($i = 1; $i <= $pages; $i++) { - ProcessWalletJournalJob::dispatch(1, $config['primary'], $i)->onQueue('journal'); - } - - //Get the total pages for the journal for the sov bills from the holding corporation - $pages = $finance->GetJournalPageCount(6, $config['primary']); - - //Dispatch a job for each page to process - for($i = 1; $i <= $pages; $i++) { - ProcessWalletJournalJob::dispatch(6, $config['primary'], $i)->onQueue('journal'); + for($i = 1; $i <= 6; $i++) { + ProcessWalletJournalJob::dispatch($i, $config['primary'])->onQueue('journal'); } } } diff --git a/app/Jobs/Commands/Finances/ProcessWalletJournalJob.php b/app/Jobs/Commands/Finances/ProcessWalletJournalJob.php index 69b0527be..a10c058c1 100644 --- a/app/Jobs/Commands/Finances/ProcessWalletJournalJob.php +++ b/app/Jobs/Commands/Finances/ProcessWalletJournalJob.php @@ -40,10 +40,9 @@ class ProcessWalletJournalJob implements ShouldQueue * * @return void */ - public function __construct($division, $charId, $page) { + public function __construct($division, $charId) { $this->division = $division; $this->charId = $charId; - $this->page = $page; $this->connection = 'redis'; } @@ -61,7 +60,7 @@ class ProcessWalletJournalJob implements ShouldQueue //Declare the class variable we need $finance = new FinanceHelper(); - $finance->GetWalletJournalPage($this->division, $this->charId, $this->page); + $finance->GetWalletJournal($this->division, $this->charId); //After the job is completed, delete the job $this->delete(); diff --git a/app/Library/Finances/Helper/FinanceHelper.php b/app/Library/Finances/Helper/FinanceHelper.php index 75f07587a..e9bf8d5c2 100644 --- a/app/Library/Finances/Helper/FinanceHelper.php +++ b/app/Library/Finances/Helper/FinanceHelper.php @@ -58,17 +58,14 @@ class FinanceHelper { $token = $esiHelper->GetRefreshToken($charId); if($token == null) { return null; - } + } + //Create an ESI authentication container + $esi = $esiHelper->SetupEsiAuthentication($token); //Reference to see if the character is in our look up table for corporations and characters $char = $lookup->GetCharacterInfo($charId); $corpId = $char->corporation_id; - //Create an ESI authentication container - $esi = $esiHelper->SetupEsiAuthentication($token); - //Set the version - $esi->setVersion('v4'); - //Set caching to null $configuration = Configuration::getInstance(); $configuration->cache = NullCache::class;