asset job

This commit is contained in:
2019-05-28 22:59:47 -05:00
parent 38a30553b4
commit 35555e3d7c
3 changed files with 32 additions and 50 deletions

View File

@@ -7,11 +7,41 @@ use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Log;
//App Library
use App\Library\Structures\StructureHelper;
use App\Jobs\Library\JobHelper;
//App Models
use App\Models\Jobs\JobProcessAssets;
use App\Models\Jobs\JobStatus;
use App\Models\Stock\Asset;
class ProcessAssetsJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Timeout in seconds
*
* @var int
*/
public $timeout = 300;
/**
* Number of job retries
*/
public $tries = 3;
/**
* Job Variables
*/
private $charId;
private $corpId;
private $page;
private $esi;
/**
* Create a new job instance.
*

View File

@@ -15,7 +15,7 @@ use App\Jobs\Library\JobHelper;
//App Models
use App\Models\Jobs\JobProcessStructure;
use App\Models\Job\JobStatus;
use App\Models\Jobs\JobStatus;
use App\Models\Structure\Structure;
class ProcessStructureJob implements ShouldQueue
@@ -40,6 +40,7 @@ class ProcessStructureJob implements ShouldQueue
private $charId;
private $corpId;
private $page;
private $esi;
/**
@@ -51,7 +52,6 @@ class ProcessStructureJob implements ShouldQueue
{
$this->charId = $jps->charId;
$this->corpId = $jps->corpId;
$this->structure = $jps->structure;
$this->page = $jps->page;
$this->esi = $jps->esi;
@@ -73,12 +73,6 @@ class ProcessStructureJob implements ShouldQueue
//Declare the structure helper class.
$structureHelper = new StructureHelper();
//Using our private function make sure we have the necessrary ESI scope
if($this->HasEsiScope() == false) {
Log::critical("Job couldn't be completed because of ESI Scopes.");
return null;
}
//Get the page of structures
$structures = $this->GetListOfStructures();
@@ -255,16 +249,4 @@ class ProcessStructureJob implements ShouldQueue
return $dateTime;
}
private function HasEsiScope() {
$esiHelper = new Esi();
$universe = $esi->HaveEsiScope($this->charId, 'esi-universe.read_structures.v1');
if($universe == true) {
return true;
} else {
return false;
}
}
}

View File

@@ -1,30 +0,0 @@
<?php
namespace App\Models\Stock;
use Illuminate\Database\Eloquent\Model;
class StructureStock extends Model
{
//Table Name
public $table = '';
//Timestamps
public $tiemestamps = false;
/**
* The attributes that are mass assignable
*
* @var array
*/
protected $fillable = [
'structure_name',
'structure_id',
'location_flag',
'location_id',
'location_type',
'item_id',
'type_id',
'quantity',
];
}