cleaned up code base thoroughly
This commit is contained in:
@@ -1,60 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Assets;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use DB;
|
||||
use Log;
|
||||
|
||||
//Job
|
||||
use App\Jobs\Commands\Structures\ProcessAssetsJob;
|
||||
|
||||
//Library
|
||||
use App\Library\Esi\Esi;
|
||||
use Commands\Library\CommandHelper;
|
||||
use App\Library\Assets\AssetHelper;
|
||||
use Seat\Eseye\Exceptions\RequestFailedException;
|
||||
|
||||
class GetAssetsCommand extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'services:GetAssets';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Gets all of the assets of the holding corporation.';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
//Create the command helper container
|
||||
$task = new CommandHelper('GetAssets');
|
||||
//Add the entry into the jobs table saying the job is starting
|
||||
$task->SetStartStatus();
|
||||
|
||||
ProcessAssetsJob::dispatch($charId, $corpId)->onQueue('assets');
|
||||
|
||||
$task->SetStopStatus();
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ use Seat\Eseye\Exceptions\RequestFailedException;
|
||||
use App\Library\Esi\Esi;
|
||||
use Seat\Eseye\Cache\NullCache;
|
||||
use Seat\Eseye\Configuration;
|
||||
use App\Library\Helpers\FinanceHelper;
|
||||
|
||||
class Test extends Command
|
||||
{
|
||||
@@ -48,27 +49,11 @@ class Test extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
//Declare some variables
|
||||
$esiHelper = new Esi;
|
||||
$helper = new FinanceHelper;
|
||||
$config = config('esi');
|
||||
|
||||
$receipt = $helper->GetApiWalletJournal(1, $config['primary']);
|
||||
|
||||
//Set caching to null
|
||||
$configuration = Configuration::getInstance();
|
||||
$configuration->cache = NullCache::class;
|
||||
|
||||
//Get the ESI Token
|
||||
$token = $esiHelper->GetRefreshToken($config['primary']);
|
||||
$esi = $esiHelper->SetupEsiAuthentication($token);
|
||||
|
||||
try {
|
||||
$stuff = $esi->invoke('get', '/corporations/{corporation_id}/wallets/{division}/journal/', [
|
||||
'corporation_id' => $config['corporation'],
|
||||
'division' => 1,
|
||||
]);
|
||||
} catch(RequestFailedException $e) {
|
||||
dd($e);
|
||||
}
|
||||
|
||||
dd(json_decode($stuff->raw, true));
|
||||
var_dump($receipt);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Finances;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
use App\Library\Finances\Helper\FinanceHelper;
|
||||
|
||||
//Jobs
|
||||
use App\Jobs\Commands\Finances\ProcessWalletJournalJob;
|
||||
|
||||
class HoldingFinancesCommand extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'services:HoldingJournal';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Get the holding corps finances.';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
//Setup the Finances container
|
||||
$finance = new FinanceHelper();
|
||||
|
||||
//Get the esi configuration
|
||||
$config = config('esi');
|
||||
|
||||
for($i = 1; $i <= 6; $i++) {
|
||||
ProcessWalletJournalJob::dispatch($i, $config['primary'])->onQueue('journal');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,110 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Finances;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
|
||||
use App\Library\Finances\Helper\FinanceHelper;
|
||||
|
||||
//Jobs
|
||||
use App\Jobs\Commands\Finances\ProcessWalletJournalJob;
|
||||
|
||||
//Models
|
||||
use App\Models\Esi\EsiToken;
|
||||
use App\Models\Esi\EsiScope;
|
||||
|
||||
//Library
|
||||
use App\Library\Esi\Esi;
|
||||
use App\Library\Lookups\LookupHelper;
|
||||
|
||||
//Seat Stuff
|
||||
use Seat\Eseye\Exceptions\RequestFailedException;
|
||||
use Seat\Eseye\Cache\NullCache;
|
||||
use Seat\Eseye\Configuration;
|
||||
|
||||
class SovBillsCommand extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'services:SovBills';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Get the holding corps sov bills from wallet 6.';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$sovBill = new SovBillExpenses;
|
||||
$esiHelper = new Esi;
|
||||
$finance = new FinanceHelper();
|
||||
$lookup = new LookupHelper;
|
||||
|
||||
//Get the esi configuration
|
||||
$config = config('esi');
|
||||
//Set caching to null
|
||||
$configuration = Configuration::getInstance();
|
||||
$configuration->cache = NullCache::class;
|
||||
|
||||
$token = $esiHelper->GetRefreshToken($config['primary']);
|
||||
if($token == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
//Create an ESI authentication container
|
||||
$esi = $esiHelper->SetupEsiAuthentication($token);
|
||||
$esi->setVersion('v4');
|
||||
|
||||
//Reference to see if the character is in our look up table for corporations and characters
|
||||
$char = $lookup->GetCharacterInfo($config['primary']);
|
||||
$corpId = $char->corporation_id;
|
||||
|
||||
//Get the total pages for the journal for the sov bills from the holding corporation
|
||||
$pages = $finance->GetJournalPageCount(6, $config['primary']);
|
||||
|
||||
//Try to figure it out from the command itself.
|
||||
for($i = 1; $i <= $pages; $i++) {
|
||||
printf("Getting page: " . $i . "\n");
|
||||
|
||||
try {
|
||||
$journals = $esi->page($i)
|
||||
->invoke('get', '/corporations/{corporation_id}/wallets/{division}/journal/', [
|
||||
'corporation_id' => $corpId,
|
||||
'division' => 6,
|
||||
]);
|
||||
} catch(RequestFailedException $e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
//Decode the wallet from json into an array
|
||||
$wallet = json_decode($journals->raw, true);
|
||||
dd($wallet);
|
||||
foreach($wallet as $entry) {
|
||||
if($entry['ref_type'] == 'infrastructure_hub_maintenance' && $entry['first_party_id'] == 98287666) {
|
||||
$sovBill->InsertSovBillExpense($entry, $corpId, $division);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,21 +23,11 @@ class Kernel extends ConsoleKernel
|
||||
Commands\Data\PurgeUsers::class,
|
||||
Commands\Data\EmptyJumpBridges::class,
|
||||
Commands\Data\CleanStaleDataCommand::class,
|
||||
Commands\Data\GetCorpsCommand::class,
|
||||
Commands\Data\Test::class,
|
||||
/**
|
||||
* Assets Commands
|
||||
*/
|
||||
Commands\Assets\GetAssetsCommand::class,
|
||||
/**
|
||||
* Eve Commands
|
||||
*/
|
||||
Commands\Eve\ItemPricesUpdateCommand::class,
|
||||
/**
|
||||
* Finances Commands
|
||||
*/
|
||||
Commands\Finances\HoldingFinancesCommand::class,
|
||||
Commands\Finances\SovBillsCommand::class,
|
||||
/**
|
||||
* Mining Tax Commands
|
||||
*/
|
||||
@@ -45,10 +35,6 @@ class Kernel extends ConsoleKernel
|
||||
Commands\MiningTaxes\MiningTaxesLedgers::class,
|
||||
Commands\MiningTaxes\MiningTaxesObservers::class,
|
||||
Commands\MiningTaxes\MiningTaxesPayments::class,
|
||||
/**
|
||||
* Structures Command
|
||||
*/
|
||||
Commands\Structures\GetStructuresCommand::class,
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -61,34 +47,6 @@ class Kernel extends ConsoleKernel
|
||||
{
|
||||
//Horizon Graph Schedule
|
||||
$schedule->command('horizon:snapshot')->everyFiveMinutes();
|
||||
|
||||
/**
|
||||
* Moon Update Schedule
|
||||
*/
|
||||
|
||||
/**
|
||||
* System Rental Schedule
|
||||
*/
|
||||
$schedule->command('services:SystemRentals')
|
||||
->monthlyOn(1, '00:01')
|
||||
->withoutOverlapping();
|
||||
/**
|
||||
* Holding Corp Finance Schedule
|
||||
*/
|
||||
$schedule->command('services:HoldingJournal')
|
||||
->hourlyAt('45')
|
||||
->withoutOverlapping();
|
||||
|
||||
/**
|
||||
* Get Information Schedule
|
||||
*/
|
||||
$schedule->command('services:GetCorps')
|
||||
->monthlyOn(1, '09:00');
|
||||
$schedule->command('services:GetStructures')
|
||||
->dailyAt('09:00');
|
||||
$schedule->command('services:GetAssets')
|
||||
->hourlyAt('22');
|
||||
|
||||
/**
|
||||
* Purge Data Schedule
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user