created framework for market orders and public contracts

This commit is contained in:
2020-05-14 03:51:58 -05:00
parent 47b0949290
commit 5e435bdf1a
18 changed files with 720 additions and 27 deletions
+4 -5
View File
@@ -49,7 +49,7 @@ class Kernel extends ConsoleKernel
->withoutOverlapping();
//Command to update moon rental pricing
$schedule->command('services:UpdateMoonPrice')
->hourly()
->hourlyAt('30')
->withoutOverlapping();
//Get the corps within the alliance
$schedule->command('services:GetCorps')
@@ -57,8 +57,7 @@ class Kernel extends ConsoleKernel
->withoutOverlapping();
//Update the moons, and send out mails for current moon rentals
$schedule->command('services:MoonMailer')
->monthlyOn(1, '00:01')
->withoutOverlapping();
->monthlyOn(1, '00:01');
//Get the structures within the alliance and their information
$schedule->command('services:GetStructures')
->dailyAt('09:00')
@@ -83,8 +82,8 @@ class Kernel extends ConsoleKernel
->hourlyAt(20);
//Purge old data from the database
$schedule->command('services:CleanData')
->weekly(7, '11:00')
->withoutOverlapping();
->weekly(7, '11:00')
->withoutOverlapping();
}
/**
@@ -0,0 +1,35 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
class BuyContractController extends Controller
{
/**
* Contracts construct
*/
public function __construct() {
$this->middleware('auth');
$this->middleware('role:User');
}
/**
* Display region form to pick different regions such as Esoteria, Catch, Immensea
*/
public function displayRegionalContractForm() {
return view('contracts.regional.user.displayregion');
}
/**
* Display the contracts in a region
*/
public function displayRegionalContracts() {
$this->validate('request', [
'region_id' => 'required',
]);
return view('contracts.regional.user.displaycontracts');
}
}
@@ -0,0 +1,42 @@
<?php
namespace App\Jobs\Commands\Market;
//Internal Library
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Carbon\Carbon;
use Log;
//App Library
use Seat\Eseye\Exceptions\RequestFailedException;
use App\Library\Esi\Esi;
use App\Library\Lookups\LookupHelper;
class GetMarketGroupsJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
//
}
}
@@ -0,0 +1,42 @@
<?php
namespace App\Jobs\Commands\Market;
//Internal Library
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Carbon\Carbon;
use Log;
//App Library
use Seat\Eseye\Exceptions\RequestFailedException;
use App\Library\Esi\Esi;
use App\Library\Lookups\LookupHelper;
class GetMarketPricesJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
//
}
}
@@ -0,0 +1,42 @@
<?php
namespace App\Jobs\Commands\Market;
//Internal Library
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Carbon\Carbon;
use Log;
//App Library
use Seat\Eseye\Exceptions\RequestFailedException;
use App\Library\Esi\Esi;
use App\Library\Lookups\LookupHelper;
class GetMarketRegionOrderJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
//
}
}
@@ -0,0 +1,49 @@
<?php
namespace App\Jobs\Commands\PublicContracts;
//Internal Libraries
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Log;
use Carbon\Carbon;
//App Library
use Seat\Eseye\Exceptions\RequestFailedException;
use App\Library\Esi\Esi;
use App\Library\Lookups\LookupHelper;
//Jobs
use App\Jobs\Commands\PublicContracts\GetPublicContractItemsJob;
//Models
use App\Models\PublicContracts\PublicContract;
use App\Models\PublicContracts\PUblicContractItem;
class GetPublicContractItemsJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
//
}
}
@@ -0,0 +1,45 @@
<?php
namespace App\Jobs\Commands\PublicContracts;
//Internal Libraries
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Log;
use Carbon\Carbon;
//App Library
use Seat\Eseye\Exceptions\RequestFailedException;
use App\Library\Esi\Esi;
use App\Library\Lookups\LookupHellper;
//Models
use App\Models\PublicContracts\PublicContract;
class GetPublicContractsJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
//
}
}
+74
View File
@@ -0,0 +1,74 @@
<?php
namespace App\Library\Market;
//Internal Library
use Log;
use Carbon\Carbon;
//Library
use App\Library\Esi\Esi;
class MarketHelper {
/**
* Private variables
*
* @var esi
*/
private $esi;
/**
* Class Construct
*/
public function __construct($esi = null) {
$this->esi = $esi;
}
/**
* Get the regional market orders
*
* @var region
*/
public function GetRegionalMarketOrders($region) {
}
/**
* Price an item out and return the different price schemes
*
* @var itemId
*/
public function PriceItem($itemId) {
}
/**
* Get the market group infromation
*
* @var group
*/
public function GetMarketGroup($group) {
}
/**
* Get the public contract items
*
* @var contractId
*/
public function GetPublicContractItem($contractId) {
}
/**
* Get market price for an item
*
* @var itemId
*/
public function GetMarketPrice($itemId) {
}
}
?>
@@ -0,0 +1,85 @@
<?php
namespace App\Library\RegionalContracts;
//Internal Library
use Log;
use Carbon\Carbon;
//Library
use App\Library\Esi\Esi;
class RegionalContractHelper {
/**
* Region variable
*
* @var int
*/
private $region;
/**
* ESI Variable
*
* @var esi
*/
private $esi;
/**
* Construct
*/
public function __construct($region, $esi) {
$this->region = $region;
$this->esi = $esi;
}
/**
* Get the contracts within a region
*
* @var private
*/
public function GetContracts() {
//Get the public contracts from the ESI
$responses = $this->esi->invoke('get', '/contracts/public/{region_id}/', [
'region_id' => $this->region,
]);
//Send the contracts back to the calling function
return $responses;
}
/**
* Price the regional contract
*
* @var buyout
* @var contract_id
* @var date_expired
* @var date_issued
* @var days_to_complete
* @var end_location_id
* @var issuer_id
* @var price
* @var title
* @var type [unknown, item_exchange, auction, courier, loan]
* @var volume
*/
public function PriceContract($contract) {
}
/**
* Function to get the items in a contract from ESI
*
* @var id
*/
public function GetContractItems($contractId) {
$items = $this->esi->invoke('get', '/contracts/public/items/{contract_id}/', [
'contract_id' => $contractId,
]);
return $items;
}
}
?>
+28
View File
@@ -0,0 +1,28 @@
<?php
namespace App\Models\Market;
use Illuminate\Database\Eloquent\Model;
class MarketGroup extends Model
{
//Table Name
protected $table = 'market_groups';
//Timestamps
public $timestamps = true;
/**
* Items which are mass assignable
*
* @var array
*/
protected $fillable = [
'group',
'description',
'market_group_id',
'name',
'parent_group_id',
'types',
];
}
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace App\Models\Market;
use Illuminate\Database\Eloquent\Model;
class MarketPrice extends Model
{
//Table Name
protected $table = 'market_prices';
//Timestamps
public $timestamps = true;
/**
* Items which are mass assignable
*
* @var array
*/
protected $fillable = [
'type_id',
'adjusted_price',
'average_price',
'lowest_price',
'highest_price',
'order_count',
'volume',
];
}
+34
View File
@@ -0,0 +1,34 @@
<?php
namespace App\Models\Market;
use Illuminate\Database\Eloquent\Model;
class MarketRegionOrder extends Model
{
//Table Name
protected $table = 'market_region_orders';
//Timestamps
public $timestamps = true;
/**
* Items which are mass assignable
*
* @var array
*/
protected $fillable = [
'duration',
'is_buy_order',
'issued',
'location_id',
'min_volume',
'order_id',
'price',
'range',
'system_id',
'type_id',
'volume_remain',
'volume_total',
];
}
@@ -0,0 +1,38 @@
<?php
namespace App\Models\PublicContracts;
use Illuminate\Database\Eloquent\Model;
class PublicContract extends Model
{
//Table Name
protected $table = 'public_contracts';
//Timestamps
public $timestamps = false;
/**
* Items which are mass assignable
*
* @var array
*/
protected $fillable = [
'buyout',
'collateral',
'contract_id',
'date_expired',
'date_issued',
'days_to_complete',
'end_location_id',
'for_corporation',
'issuer_corporation_id',
'issuer_id',
'price',
'reward',
'start_location_id',
'title',
'type',
'volume',
];
}
@@ -0,0 +1,31 @@
<?php
namespace App\Models\PublicContracts;
use Illuminate\Database\Eloquent\Model;
class PublicContractItem extends Model
{
//Table Name
protected $table = 'public_contract_items';
//Timestamps
public $timestamps = true;
/**
* Items which are mass assignable
*
* @var array
*/
protected $fillable = [
'is_blueprint_copy',
'is_included',
'item_id',
'material_efficency',
'quantity',
'record_id',
'runs',
'time_efficiency',
'type_id',
];
}