logistics module

This commit is contained in:
2019-07-06 04:04:30 -05:00
parent 7eceef4818
commit 4a38bc2fee
13 changed files with 743 additions and 3 deletions

View File

@@ -0,0 +1,76 @@
<?php
namespace App\Jobs;
//Internal Library
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
//App Library
use App\Library\Logistics\ContractsHelper;
//App Models
use App\Models\Jobs\JobProcessContracts;
use App\Models\Job\JobStatus;
class ProcessEveContractsJob 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;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct(JobProcessContracts $jpc)
{
$this->charId = $jpc->charId;
$this->corpId = $jpc->corpId;
$this->page = $jpc->page;
//Set the connection for the job
$this->connection = 'redis';
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
//Declare the contracts helper
$cHelper = new EveContractsHelper($this->charId, $this->corpId, $this->page);
$contracts = $cHelper->GetContractsByPage();
foreach($contracts as $contract) {
$cHelper->ProcessContract($contract);
}
//After the job is completed, delete the job
$this->delete();
}
}