added backend functions for jump bridge fuel display with the new way we are doing jobs

This commit is contained in:
2021-05-17 06:08:05 +09:00
parent a0c0186337
commit de0071734b
15 changed files with 824 additions and 60 deletions

View File

@@ -0,0 +1,46 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Jobs\Commands\Structure\FetchAllianceAssets as FAA;
class ExecuteFetchAllianceAssetsCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'structure:assets';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Execute fetch alliance command.';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
FAA::dispatch()->onQueue('default');
return 0;
}
}

View File

@@ -0,0 +1,46 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Jobs\Commands\Structures\FetchAllianceStructures as FAS;
class ExecuteFetchAllianceStructuresCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'structure:structure';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Fetch alliance structures command.';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
FAS::dispatch()->onQueue('default');
return 0;
}
}

View File

@@ -50,9 +50,6 @@ class Kernel extends ConsoleKernel
//Horizon Graph Schedule //Horizon Graph Schedule
$schedule->command('horizon:snapshot')->everyFiveMinutes(); $schedule->command('horizon:snapshot')->everyFiveMinutes();
//Test rung to help figure out what is going on.
//$schedule->command('inspire')->everyMinute();
/** /**
* Purge Data Schedule * Purge Data Schedule
*/ */
@@ -96,6 +93,23 @@ class Kernel extends ConsoleKernel
$schedule->job(new UpdateMiningTaxesLateInvoices15th) $schedule->job(new UpdateMiningTaxesLateInvoices15th)
->timezone('UTC') ->timezone('UTC')
->monthlyOn(15, '16:00'); ->monthlyOn(15, '16:00');
/**
* Alliance Structure and Assets Schedule
*/
$schedule->job(new FetchAllianceStructures)
->timezone('UTC')
->dailyAt('21:00');
$schedule->job(new FetchAllianceAssets)
->timezone('UTC')
->hourlyAt('15');
$schedule->job(new PurgeAllianceStructures)
->timezone('UTC')
->monthlyOn(2, '14:00');
$schedule->job(new PurgeAllianceAssets)
->timezone('UTC')
->monthlyOn(2, '15:00');
} }
/** /**

View File

@@ -0,0 +1,150 @@
<?php
namespace App\Jobs\Commands\Assets;
//Internal Library
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
//Application Library
use App\Library\Esi\Esi;
use App\Library\Helpers\LookupHelper;
use Seat\Eseye\Exceptions\RequestFailedException;
//Models
use App\Models\Structure\Asset;
class FetchAllianceAssets 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()
{
//Declare variables
$config = config('esi');
$corpId = 98287666;
//Get the refresh token from the database
$token = $esiHelper->GetRefreshToken($config['primary']);
//Create the esi authentication container
$esi = $esiHelper->SetupEsiAuthentication($token);
//Check the esi scope
if(!$esiHelpeer->HaveEsiScope($config['primary'], 'esi-assets.read_corporation_assets.v1')) {
Log::critical("Scope check failed in FetchAllianceAssets for esi-assets.read_corporation_assets.v1");
}
//Set the current page
$currentPage = 1;
//Set our default pages
$totalPages = 1;
do {
//Attempt to get the assets
$assets = $esi->page($currentPage)
->invoke('get', '/corporations/{corporation_id}/assets/', [
'corporation_id' => $corpId,
]);
//If on the first page, then update the total number of pages
if($currentPage == 1) {
$totalPages = $assets->pages;
}
//For each asset retrieved, let's process it.
foreach($assets as $a) {
ProcessAllianceAssets::dispatch($a)->onQueue('default');
}
//Increment the current page
$currentPage++;
} while($currentPage <= $totalPages);
}
/**
* The job failed to process
* @param Exception $exception
* @return void
*/
public function failed($exception) {
if(!exception instanceof RequestFailedException) {
//If not a failure due to ESI, then log it. Otherwise,
//deduce why the exception occurred.
Log::critical($exception);
}
if ((is_object($exception->getEsiResponse()) && (stristr($exception->getEsiResponse()->error, 'Too many errors') || stristr($exception->getEsiResponse()->error, 'This software has exceeded the error limit for ESI'))) ||
(is_string($exception->getEsiResponse()) && (stristr($exception->getEsiResponse(), 'Too many errors') || stristr($exception->getEsiResponse(), 'This software has exceeded the error limit for ESI')))) {
//We have hit the error rate limiter, wait 120 seconds before releasing the job back into the queue.
Log::info('FetchMiningTaxesObservers has hit the error rate limiter. Releasing the job back into the wild in 2 minutes.');
$this->release(120);
} else {
$errorCode = $exception->getEsiResponse()->getErrorCode();
switch($errorCode) {
case 400: //Bad Request
Log::critical("Bad request has occurred in FetchMiningTaxesObservers. Job has been discarded");
break;
case 401: //Unauthorized Request
Log::critical("Unauthorized request has occurred in FetchMiningTaxesObservers at " . Carbon::now()->toDateTimeString() . ".\r\nCancelling the job.");
break;
case 403: //Forbidden
Log::critical("FetchMiningTaxesObservers has incurred a forbidden error. Cancelling the job.");
break;
case 420: //Error Limited
Log::warning("Error rate limit occurred in FetchMiningTaxesObservers. Restarting job in 120 seconds.");
$this->release(120);
break;
case 500: //Internal Server Error
Log::critical("Internal Server Error for ESI in FetchMiningTaxesObservers. Attempting a restart in 120 seconds.");
$this->release(120);
break;
case 503: //Service Unavailable
Log::critical("Service Unavailabe for ESI in FetchMiningTaxesObservers. Releasing the job back to the queue in 30 seconds.");
$this->release(30);
break;
case 504: //Gateway Timeout
Log::critical("Gateway timeout in FetchMiningTaxesObservers. Releasing the job back to the queue in 30 seconds.");
$this->release(30);
break;
case 201: //Good response code
$this->delete();
break;
//If no code is given, then log and break out of switch.
default:
Log::warning("No response code received from esi call in FetchMiningTaxesObservers.\r\n");
$this->delete();
break;
}
}
}
/**
* Tags for jobs
*
* @var array
*/
public function tags() {
return ['FetchAllianceAssets', 'AllianceStructures', 'Asset'];
}
}

View File

@@ -1,6 +1,6 @@
<?php <?php
namespace App\Jobs\Commands\JumpBridges; namespace App\Jobs\Commands\Assets;
use Illuminate\Bus\Queueable; use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Contracts\Queue\ShouldQueue;
@@ -8,7 +8,7 @@ use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
class FetchJumpBridges implements ShouldQueue class ProcessAllianceAssets implements ShouldQueue
{ {
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

View File

@@ -1,17 +1,21 @@
<?php <?php
namespace App\Jobs\Commands\JumpBridges; namespace App\Jobs\Commands\Assets;
//Internal Library
use Illuminate\Bus\Queueable; use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
//Jobs
use App\Jobs\Commands\Assets\FetchAllianceAssets;
//Models //Models
use App\Models\Structure\Asset; use App\Models\Structure\Asset;
class PurgeLiquidOzoneAssets implements ShouldQueue class PurgeAllianceAssets implements ShouldQueue
{ {
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
@@ -32,6 +36,8 @@ class PurgeLiquidOzoneAssets implements ShouldQueue
*/ */
public function handle() public function handle()
{ {
Asset::truncate();
FetchAllianceAssets::dispatch()->onQueue('default');
} }
} }

View File

@@ -1,34 +0,0 @@
<?php
namespace App\Jobs\Commands\JumpBridges;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class PurgeJumpBridgeStructures 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()
{
//
}
}

View File

@@ -0,0 +1,157 @@
<?php
namespace App\Jobs\Commands\Structures;
//Internal Library
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
//Application Library
use App\Library\Esi\Esi;
use Seat\Eseye\Exception\RequestFailedException;
use App\Library\Structures\StructureHelper;
//Models
use App\Models\Structure\Structure;
use App\Models\Structure\Service;
class FetchAllianceStructures 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()
{
//Declare variables
$config = config('esi');
$corpId = 98287666;
$esiHelper = new Esi;
$structureScope = $esiHelper->HaveEsiScope($config['primary'], 'esi-universe.read_structures.v1');
$corpStructureScope = $esiHelper->HaveEsiScope($config['primary'], 'esi-corporations.read_structures.v1');
//Check scopes
if($structureScope == false || $corpStructureScope == false) {
if($structureScope == false) {
Log::critical("Scope check for esi-universe.read_structures.v1 has failed.");
}
if($corpStructureScope == false) {
Log::critical("Scope check for esi-corporations.read_structures.v1 has failed.");
}
return -1;
}
//Get the refresh token from the database
$token = $esiHelper->GetRefreshToken($config['primary']);
//Create the esi authentication container
$esi = $esiHelper->SetupEsiAuthentication($token);
//Set the current page
$currentPage = 1;
//Set our default pages
$totalPages = 1;
do {
//Attempt to get the entire page worth of structures
$structures = $esi->page($currentPage)
->invoke('get', '/corporations/{corporation_id}/structures/', [
'corporation_id' => $corpId,
]);
//If on the first page, then update the total number of pages
if($currentPage == 1) {
$totalPages = $structures->pages;
}
//For each asset retrieved, let's process it.
foreach($structures as $s) {
ProcessAllianceStructures::dispatch($s)->onQueue('default');
}
//Increment the current page
$currentPage++;
} while($currentPage <= $totalPages);
}
/**
* The job failed to process
* @param Exception $exception
* @return void
*/
public function failed($exception) {
if(!exception instanceof RequestFailedException) {
//If not a failure due to ESI, then log it. Otherwise,
//deduce why the exception occurred.
Log::critical($exception);
}
if ((is_object($exception->getEsiResponse()) && (stristr($exception->getEsiResponse()->error, 'Too many errors') || stristr($exception->getEsiResponse()->error, 'This software has exceeded the error limit for ESI'))) ||
(is_string($exception->getEsiResponse()) && (stristr($exception->getEsiResponse(), 'Too many errors') || stristr($exception->getEsiResponse(), 'This software has exceeded the error limit for ESI')))) {
//We have hit the error rate limiter, wait 120 seconds before releasing the job back into the queue.
Log::info('FetchMiningTaxesObservers has hit the error rate limiter. Releasing the job back into the wild in 2 minutes.');
$this->release(120);
} else {
$errorCode = $exception->getEsiResponse()->getErrorCode();
switch($errorCode) {
case 400: //Bad Request
Log::critical("Bad request has occurred in FetchMiningTaxesObservers. Job has been discarded");
break;
case 401: //Unauthorized Request
Log::critical("Unauthorized request has occurred in FetchMiningTaxesObservers at " . Carbon::now()->toDateTimeString() . ".\r\nCancelling the job.");
break;
case 403: //Forbidden
Log::critical("FetchMiningTaxesObservers has incurred a forbidden error. Cancelling the job.");
break;
case 420: //Error Limited
Log::warning("Error rate limit occurred in FetchMiningTaxesObservers. Restarting job in 120 seconds.");
$this->release(120);
break;
case 500: //Internal Server Error
Log::critical("Internal Server Error for ESI in FetchMiningTaxesObservers. Attempting a restart in 120 seconds.");
$this->release(120);
break;
case 503: //Service Unavailable
Log::critical("Service Unavailabe for ESI in FetchMiningTaxesObservers. Releasing the job back to the queue in 30 seconds.");
$this->release(30);
break;
case 504: //Gateway Timeout
Log::critical("Gateway timeout in FetchMiningTaxesObservers. Releasing the job back to the queue in 30 seconds.");
$this->release(30);
break;
case 201: //Good response code
$this->delete();
break;
//If no code is given, then log and break out of switch.
default:
Log::warning("No response code received from esi call in FetchMiningTaxesObservers.\r\n");
$this->delete();
break;
}
}
}
public function tags() {
return ['FetchAllianceStructures', 'AllianceStructures', 'Structures'];
}
}

View File

@@ -0,0 +1,203 @@
<?php
namespace App\Jobs\Commands\Structures;
//Internal Library
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
//Application Library
use App\Library\Helpers\LookupHelper;
use App\Library\Esi\Esi;
//Jobs
use App\Jobs\Commands\Structures\ProcessAllianceStructureServices;
//Models
use App\Models\Structure\Structure;
use App\Models\Structure\Service;
class ProcessAllianceStructures implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
private $structure;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($s)
{
//Set variables
$this->structure = $s;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
/**
* Update the structure if it already exists, or add the structure if it doesn't exist in the database
*/
if(Structure::where(['structure_id' => $this->structure->structure_id])->count() > 0) {
$this->UpdateStructure($this->structure);
} else {
$this->SaveNewStructure($this->structure);
}
}
/**
* Set the tags for the job
*
* @var array
*/
public function tags() {
return ['ProcessAllianceStructures', 'AllianceStructures', 'Structures'];
}
private SaveNewStructure($structure) {
//Declare variables
$lookup = new LookupHelper;
$esiHelper = new Esi;
//Get the solar system name
$solarName = $lookup->SolarSystemIdToName($structure->system_id);
$s = new Structure;
$s->structure_id = $structure->structure_id;
$s->structure_name = $structure->name;
$s->solar_system_id = $structure->system_id;
$s->solar_system_name = $solarName;
$s->type_id = $structure->type_id;
$s->type_name = $lookup->StructureTypeIdToName($structure->type_id);
$s->corporation_id = $structure->corporation_id;
if(isset($structure->services)) {
$s->services = true;
} else {
$s->services = false;
}
$s->state = $structure->state;
if(isset($structre->state_timer_start)) {
$s->state_timer_start = $esiHelper->DecodeDate($structure->state_timer_start);
}
if(isset($structure->state_timer_end)) {
$s->state_timer_end = $esiHelper->DecodeDate($structure->state_timer_end);
}
if(isset($structure->fuel_expires)) {
$s->fuel_expires = $esiHelper->DecodeDate($structure->fuel_expires);
}
$s->profile_id = $structure->profile_id;
if(isset($structure->next_reinforce_apply)) {
$s->next_reinforce_apply = $structure->next_reinforce_apply;
}
if(isset($structure->next_reinforce_hour)) {
$s->next_reinforce_hour = $structure->next_reinforce_hour;
}
$s->reinforce_hour = $structure->reinforce_hour;
if(isset($structure->unanchors_at)) {
$s->unanchors_at = $esiHelper->DecodeDate($s->unanchors_at);
}
$s->save();
//If there are services on the structure, then save the service and the structure id in the database table.
if($s->services == true) {
foreach($structure->services as $service) {
$serv = new Service;
$serv->structure_id = $structure->structure_id;
$serv->name = $service->name;
$serv->state = $service->state;
}
}
}
private UpdateStructure($structure) {
if(isset($structure->corporation_id)) {
Structure::where([
'structure_id' => $structure->structure_id,
])->update([
'corporation_id' => $structure->corporation_id,
]);
}
if(isset($structure->state)) {
Structure::where([
'structure_id' => $structure->structure_id,
])->update([
'state' => $structure->state,
]);
}
if(isset($structure->state_timer_start)) {
Structure::where([
'structure_id' => $structure->structure_id,
])->update([
'state_timer_start' => $structure->state_timer_start,
]);
}
if(isset($structure->state_timer_end)) {
Structure::where([
'structure_id' => $structure->structure_id,
])->update([
'state_timer_end' => $structure->state_timer_end,
]);
}
if(isset($structure->fuel_expires)) {
Structure::where([
'structure_id' => $structure->structure_id,
])->update([
'fuel_expires' => $structure->fuel_expires,
]);
}
if(isset($structure->profile_id)) {
Structure::where([
'structure_id' => $structure->structure_id,
])->update([
'profile_id' => $structure->profile_id,
]);
}
if(isset($structure->next_reinforce_apply)) {
Structure::where([
'structure_id' => $structure->structure_id,
])->update([
'next_reinforce_apply' => $structure->next_reinforce_apply,
]);
}
if(isset($structure->next_reinforce_hour)) {
Structure::where([
'structure_id' => $structure->structure_id,
])->update([
'next_reinforce_hour' => $structure->next_reinforce_hour,
]);
}
if(isset($structure->reinforce_hour)) {
Structure::where([
'structure_id' => $structure->structure_id,
])->update([
'reinforce_hour' => $structure->reinforce_hour,
]);
}
if(isset($structure->unanchors_at)) {
Structure::where([
'structure_id' => $structure->structure_id,
])->update([
'unanchors_at' => $structure->unanchors_at,
]);
}
if(Service::where(['structure_id' => $structure->structure_id])->count() > 0) {
foreach($structure->services as $service) {
Service::where([
'structure_id' => $structure->structure_id,
])->update([
'state' => $service->state,
]);
}
}
}
}

View File

@@ -1,14 +1,22 @@
<?php <?php
namespace App\Jobs\Commands\JumpBridges; namespace App\Jobs\Commands\Structures;
//Internal Library
use Illuminate\Bus\Queueable; use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
class FetchLiquidOzoneAssets implements ShouldQueue //Jobs
use App\Jobs\Commands\FetchAllianceStructures;
//Models
use App\Models\Structure\Structure;
use App\Models\Structure\Service;
class PurgeAllianceStructures implements ShouldQueue
{ {
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
@@ -29,6 +37,9 @@ class FetchLiquidOzoneAssets implements ShouldQueue
*/ */
public function handle() public function handle()
{ {
// Structure::truncate();
Service::truncate();
FetchAllianceStructures::dispatch()->onQueue('default');
} }
} }

View File

@@ -32,6 +32,42 @@ class LookupHelper {
$this->esi = $esiHelper->SetupEsiAuthentication(); $this->esi = $esiHelper->SetupEsiAuthentication();
} }
public function StructureTypeIdToName($typeId) {
$structureTypes = [
35841 => 'Ansiblex Jump Gate',
35840 => 'Pharolux Cyno Beacon',
37534 => 'Tenebrex Cyno Jammer',
35834 => 'Keepstar',
35833 => 'Fortizar',
35832 => 'Astrahus',
35836 => 'Tatara',
35835 => 'Athanor',
35827 => 'Sotiyo',
35826 => 'Azbel',
35825 => 'Raitaru',
]
return $structureTypes[$typeId];
}
public function StructureNameToTypeId($name) {
$structureTypes = [
'Ansiblex Jump Gate' => 35841,
'Pharolux Cyno Beacon' => 35840,
'Tenebrex Cyno Jammer' => 37534,
'Keepstar' => 35834,
'Fortizar' => 35833,
'Astrahus' => 35832,
'Tatara' => 35836,
'Athanor' => 35835,
'Sotiyo' => 35827,
'Azbel' => 35826,
'Raitaru' => 35825,
];
return $structureTypes[$name];
}
public function ItemNameToId($itemName) { public function ItemNameToId($itemName) {
$item = ItemLookup::where([ $item = ItemLookup::where([
'name' => $itemName, 'name' => $itemName,

View File

@@ -34,6 +34,7 @@ class Asset extends Model
'location_type', 'location_type',
'quantity', 'quantity',
'type_id', 'type_id',
'created_at',
'updated_at', 'updated_at',
]; ];

View File

@@ -10,7 +10,7 @@ class Service extends Model
public $table = 'alliance_services'; public $table = 'alliance_services';
//Timestamps //Timestamps
public $timestamps = false; public $timestamps = true;
//Primary Key //Primary Key
public $primaryKey = 'id'; public $primaryKey = 'id';
@@ -24,6 +24,8 @@ class Service extends Model
'structure_id', 'structure_id',
'name', 'name',
'state', 'state',
'created_at',
'updated_at',
]; ];
public function structure() { public function structure() {

View File

@@ -31,6 +31,7 @@ class Structure extends Model
'solar_system_id', 'solar_system_id',
'solar_system_name', 'solar_system_name',
'type_id', 'type_id',
'type_name',
'corporation_id', 'corporation_id',
'services', //True or false on whether it has services which are held in a different table 'services', //True or false on whether it has services which are held in a different table
'state', 'state',
@@ -38,15 +39,12 @@ class Structure extends Model
'state_timer_end', 'state_timer_end',
'fuel_expires', 'fuel_expires',
'profile_id', 'profile_id',
'position_x',
'position_y',
'position_z',
'next_reinforce_apply', 'next_reinforce_apply',
'next_reinforce_hour', 'next_reinforce_hour',
'next_reinforce_weekday',
'reinforce_hour', 'reinforce_hour',
'reinforce_weekday',
'unanchors_at', 'unanchors_at',
'created_at',
'updated_at',
]; ];
public function services() { public function services() {

View File

@@ -29,20 +29,27 @@ class CreateJumpBridgeFuelLevelsTables extends Migration
$table->unsignedBigInteger('corporation_id'); $table->unsignedBigInteger('corporation_id');
$table->boolean('services'); $table->boolean('services');
$table->enum('state'. [ $table->enum('state'. [
'anchor_vulnerable',
'anchoring',
'armor_reinforce',
'armor_vulnerable',
'deploy_vulnerable',
'fitting_invulnerable',
'hull_reinforce',
'hull_vulnerable',
'online_deprecated',
'onlining_vulnerable',
'shield_vulnerable',
'unanchored',
'unknown',
]); ]);
$table->dateTime('state_timer_start')->nullable(); $table->dateTime('state_timer_start')->nullable();
$table->dateTime('state_timer_end')->nullable(); $table->dateTime('state_timer_end')->nullable();
$table->dateTime('fuel_expires')->nullable(); $table->dateTime('fuel_expires')->nullable();
$table->unsignedBigInteger('profile_id'); $table->unsignedBigInteger('profile_id');
$table->unsignedBigInteger('position_x');
$table->unsignedBigInteger('position_y');
$table->unsignedBigInteger('position_z');
$table->dateTime('next_reinforce_apply')->nullable(); $table->dateTime('next_reinforce_apply')->nullable();
$table->unsignedInteger('next_reinforce_hour')->nullable(); $table->unsignedInteger('next_reinforce_hour')->nullable();
$table->unsignedInteger('next_reinforce_weekday')->nullable();
$table->unsignedInteger('reinforce_hour'); $table->unsignedInteger('reinforce_hour');
$table->unsignedInteger('reinforce_weekday')->nullable();
$table->dateTime('unanchors_at')->nullable(); $table->dateTime('unanchors_at')->nullable();
$table->timestamps(); $table->timestamps();
}); });
@@ -54,7 +61,9 @@ class CreateJumpBridgeFuelLevelsTables extends Migration
$table->unsignedBigInteger('structure_id'); $table->unsignedBigInteger('structure_id');
$table->string('name'); $table->string('name');
$table->enum('state', [ $table->enum('state', [
'online',
'offline',
'cleanup',
]); ]);
$table->timestamps(); $table->timestamps();
}); });
@@ -67,11 +76,130 @@ class CreateJumpBridgeFuelLevelsTables extends Migration
$table->boolean('is_singleton'); $table->boolean('is_singleton');
$table->unsignedBigInteger('item_id'); $table->unsignedBigInteger('item_id');
$table->enum('location_flag', [ $table->enum('location_flag', [
'AssetSafety',
'AutoFit',
'Bonus',
'Booster',
'BoosterBay',
'Capsule',
'Cargo',
'CorpDeliveries',
'CorpSAG1',
'CorpSAG2',
'CorpSAG3',
'CorpSAG4',
'CorpSAG5',
'CorpSAG6',
'CorpSAG7',
'CrateLoot',
'Deliveries',
'DroneBay',
'DustBattle',
'DustDatabank',
'FighterBay',
'FighterTube0',
'FighterTube1',
'FighterTube2',
'FighterTube3',
'FighterTube4',
'FleetHangar',
'FrigateEscapeBay',
'Hangar',
'HangarAll',
'HiSlot0',
'HiSlot1',
'HiSlot2',
'HiSlot3',
'HiSlot4',
'HiSlot5',
'HiSlot6',
'HiSlot7',
'HiddenModifiers',
'Implant',
'Impounded',
'JunkyardReprocessed',
'JunkyardTrashed',
'LoSlot0',
'LoSlot1',
'LoSlot2',
'LoSlot3',
'LoSlot4',
'LoSlot5',
'LoSlot6',
'LoSlot7',
'Locked',
'MedSlot0',
'MedSlot1',
'MedSlot2',
'MedSlot3',
'MedSlot4',
'MedSlot5',
'MedSlot6',
'MedSlot7',
'OfficeFolder',
'Pilot',
'PlanetSurface',
'QuafeBay',
'QuantumCoreRoom',
'Reward',
'RigSlot0',
'RigSlot1',
'RigSlot2',
'RigSlot3',
'RigSlot4',
'RigSlot5',
'RigSlot6',
'RigSlot7',
'SecondaryStorage',
'ServiceSlot0',
'ServiceSlot1',
'ServiceSlot2',
'ServiceSlot3',
'ServiceSlot4',
'ServiceSlot5',
'ServiceSlot6',
'ServiceSlot7',
'ShipHangar',
'ShipOffline',
'Skill',
'SkillInTraining',
'SpecializedAmmoHold',
'SpecializedCommandCenterHold',
'SpecializedFuelBay',
'SpecializedGasHold',
'SpecializedIndustrialShipHold',
'SpecializedLargeShipHold',
'SpecializedMaterialBay',
'SpecializedMediumShipHold',
'SpecializedMineralHold',
'SpecializedOreHold',
'SpecializedPlanetaryCommoditiesHold',
'SpecializedSalvageHold',
'SpecializedShipHold',
'SpecializedSmallShipHold',
'StructureActive',
'StructureFuel',
'StructureInactive',
'StructureOffline',
'SubSystemBay',
'SubSystemSlot0',
'SubSystemSlot1',
'SubSystemSlot2',
'SubSystemSlot3',
'SubSystemSlot4',
'SubSystemSlot5',
'SubSystemSlot6',
'SubSystemSlot7',
'Unlocked',
'Wallet',
'Wardrobe',
]); ]);
$table->unsignedBigInteger('location_id'); $table->unsignedBigInteger('location_id');
$table->enum('location_type', [ $table->enum('location_type', [
'station',
'solar_system',
'item',
'other',
]); ]);
$table->unsignedBigInteger('quantity'); $table->unsignedBigInteger('quantity');
$table->unsignedBigInteger('type_id'); $table->unsignedBigInteger('type_id');