diff --git a/app/Console/Commands/corpJournal.php b/app/Console/Commands/corpJournal.php index 7c073aa2a..9bbb45b42 100644 --- a/app/Console/Commands/corpJournal.php +++ b/app/Console/Commands/corpJournal.php @@ -3,16 +3,20 @@ namespace App\Console\Commands; use Illuminate\Console\Command; - use DB; +use Carbon\Carbon; +//Libraries use Commands\Library\CommandHelper; use App\Library\Finances\Helper\FinanceHelper; use App\Library\Esi\Esi; -use App\Models\Corporation\CorpStructure; +//Jobs +use App\Jobs\ProcessWalletJournalJob; -use Carbon\Carbon; +//Models +use App\Models\Corporation\CorpStructure; +use App\Models\Jobs\JobProcessWalletJournal; class CorpJournalCommand extends Command { @@ -64,6 +68,20 @@ class CorpJournalCommand extends Command $finance->GetWalletJournal(1, $charId->character_id); } + //Get the corps with structures, and dispatch jobs accordingly + foreach($corps as $corp) { + $charId = CorpStructure::where(['corporation_id' => $corp->corporation_id])->first(); + $pages = $finance->GetJournalPageCount(1, $charId->character_id); + for($i = 1; $i <= $pages; $i++) { + $job = new JobProcessWalletJournal; + $job->division = $division; + $job->charId = $charId; + $job->page = $i; + $job->save(); + ProcessWalletJournalJob::dispatch($job); + } + } + //Mark the job as finished $task->SetStopStatus(); } diff --git a/app/Jobs/ProcessWalletJournalJob.php b/app/Jobs/ProcessWalletJournalJob.php index 0a1440e8c..f6015243d 100644 --- a/app/Jobs/ProcessWalletJournalJob.php +++ b/app/Jobs/ProcessWalletJournalJob.php @@ -13,7 +13,7 @@ use Illuminate\Foundation\Bus\Dispatchable; use App\Library\Finances\Helper\FinanceHelper; //App Models -use App\Models\Jobs\ProcessWalletJournalJob as JobModel; +use App\Models\Jobs\ProcessWalletJournalJobModel as JobModel; class ProcessWalletJournalJob implements ShouldQueue { diff --git a/app/Models/Jobs/ProcessWalletJournalJob.php b/app/Models/Jobs/JobProcessWalletJournal.php similarity index 89% rename from app/Models/Jobs/ProcessWalletJournalJob.php rename to app/Models/Jobs/JobProcessWalletJournal.php index 4f59fb8a9..53ce5ed0e 100644 --- a/app/Models/Jobs/ProcessWalletJournalJob.php +++ b/app/Models/Jobs/JobProcessWalletJournal.php @@ -4,7 +4,7 @@ namespace App\Models\Jobs; use Illuminate\Database\Eloquent\Model; -class ProcessWalletJournalJob extends Model +class JobProcessWalletJournal extends Model { //Table Name public $table = 'job_process_wallet_journal';