diff --git a/app/Console/Commands/Mining/MiningTaxesCommand.php b/app/Console/Commands/Mining/MiningTaxesCommand.php new file mode 100644 index 000000000..22aefbce8 --- /dev/null +++ b/app/Console/Commands/Mining/MiningTaxesCommand.php @@ -0,0 +1,42 @@ +esi = $esi; - $this->contractId = $contract; - - //Set the connection - $this->connection = 'redis'; - } - - /** - * Execute the job. - * - * @return void - */ - public function handle() - { - //Get the items from esi - $responses = $this->esi->invoke('get', '/contracts/public/items/{contract_id}/', [ - 'contract_id' => $this->contract, - ]); - - foreach($response as $resp) { - //See if the item exists - $count = PublicContractItems::where([ - 'record_id' => $resp->record_id, - ])->count(); - - //If the item doesn't exist in the database, save it to the database - if($count == 0) { - $contractItem = new PublicContractItems; - if(isset($resp->is_blueprint_copy)) { - $contractItem->is_blueprint_copy = $resp->is_blueprint_copy; - } - $contractItem->is_included = $resp->is_included; - if(isset($resp->item_id)) { - $contractItem->item_id = $resp->item_id; - } - if(isset($resp->material_efficiency)) { - $contractItem->material_efficiency = $resp->material_efficiency; - } - $contractItem->quantity = $resp->quantity; - $contractItem->recorded_id = $resp->recorded_id; - if(isset($resp->runs)) { - $contractItem->runs = $resp->runs; - } - if(isset($resp->time_efficiency)) { - $contractItem->time_efficiency = $resp->time_efficiency; - } - $contractItem->type_id = $resp->type_id; - $contractItem->save(); - } - } - } -} diff --git a/app/Jobs/Commands/PublicContracts/GetPublicContractsJob.php b/app/Jobs/Commands/PublicContracts/GetPublicContractsJob.php deleted file mode 100644 index f9aee6d4c..000000000 --- a/app/Jobs/Commands/PublicContracts/GetPublicContractsJob.php +++ /dev/null @@ -1,115 +0,0 @@ -esi = new Esi(); - } else { - $this->esi = $esi; - } - //Set the region code - $this->region = $regionId; - - //Set the connection - $this->connection = 'redis'; - } - - /** - * Execute the job. - * The job gets all of the contracts in a region - * - * @return void - */ - public function handle() - { - $responses = $this->esi->invoke('get', '/contracts/public/{region_id}/', [ - 'region_id' => $this->region, - ]); - - foreach($response as $resp) { - $count = PublicContract::where([ - 'contract_id' => $resp->contract_id, - ])->count(); - if($count == 0) { - $pub = new PublicContract; - $pub->region_id = $this->region; - if(isset($resp->buyout)) { - $pub->buyout = $resp->buyout; - } - if(isset($resp->collateral)) { - $pub->collateral = $resp->collateral; - } - $pub->contract_id = $resp->contract_id; - $pub->date_expired = $resp->date_expired; - $pub->date_issed = $resp->date_issed; - if(isset($resp->days_to_complete)) { - $pub->days_to_complete = $resp->days_to_complete; - } - if(isset($resp->end_location_id)) { - $pub->end_location_id = $resp->end_location_id; - } - if(isset($resp->for_corporation)) { - $pub->for_corporation = $resp->for_corporation; - } - $pub->issuer_corporation_id = $resp->issuer_corporation_id; - $pub->issuer_id = $resp->issuer_id; - if(isset($resp->price)) { - $pub->price = $resp->price; - } - if(isset($resp->reward)) { - $pub->reward = $resp->reward; - } - if(isset($resp->start_location_id)) { - $pub->start_location_id = $resp->start_location_id; - } - if(isset($resp->title)) { - $pub->title = $resp->title; - } - $pub->type = $resp->type; - if(isset($resp->volume)) { - $pub->volume = $resp->volume; - } - //Save the new contract - $pub->save(); - - //Dispatch a job to collect the contract items - GetPublicContractItemsJob::dispatch($this->esi, $resp->contract_id); - } - } - } -} diff --git a/app/Jobs/Commands/PublicContracts/PurgePublicContracts.php b/app/Jobs/Commands/PublicContracts/PurgePublicContracts.php deleted file mode 100644 index 2d19d6f48..000000000 --- a/app/Jobs/Commands/PublicContracts/PurgePublicContracts.php +++ /dev/null @@ -1,68 +0,0 @@ -connection = 'redis'; - } - - /** - * Execute the job. - * - * @return void - */ - public function handle() - { - //Get today's date - $today = Carbon::now(); - - //If the date for a contract has expired, then purge it from the system - $contracts = PublicContract::all(); - - //Check each contract to see if it has expired - foreach($contracts as $contract) { - //If the contract has expired, then delete the contract and all of it's items - if($today->greaterThan($contract->date_expired)) { - //Delete the contract - PublicContract::where([ - 'id' => $contract->id, - ])->delete(); - - //Delete the items from the contract from the other table - PublicContract::where([ - 'contract_id' => $contract->id, - ])->delete(); - } - } - } -} diff --git a/routes/web.php b/routes/web.php index 37c3897a8..3972b9362 100644 --- a/routes/web.php +++ b/routes/web.php @@ -76,6 +76,11 @@ Route::group(['middleware' => ['auth']], function(){ */ Route::get('/logistics/fuel/structures', 'Logistics\FuelController@displayStructures'); + /** + * Mining Moon Tax display pages + */ + //Route::get('/mining/display', 'Mining\MiningsController@displayMiningTax'); + /** * Moon Controller display pages */