job library

This commit is contained in:
2019-05-13 23:26:33 -05:00
parent 2a7c556f97
commit b20bde1f56
4 changed files with 1 additions and 58 deletions

View File

@@ -1,40 +0,0 @@
<?php
namespace App\Jobs\Library;
//Inertnal Libraries
use DB;
use Carbon\Carbon;
use App\Models\Jobs\JobStatus;
class JobHelper {
private $job_name;
private $complete;
private $system_time;
protected $jobStatus;
public function __construct($name) {
$this->job_name = $name;
$this->complete = false;
$this->system_time = Carbon::now();
}
public function SetStartStatus() {
$this->jobStatus = new JobStatus;
$this->jobStatus->job_name = $this->job_name;
$this->jobStatus->complete = $this->complete;
$this->jobStatus->system_time = $this->system_time;
}
public function SetStopStatus() {
$this->jobStatus::update([
'complete' => true,
]);
}
public function CleeanJobStatusTable() {
DB::table('job_statuses')->where('system_time', '<', Carbon::now()->subMonths(3))->delete();
}
}

View File

@@ -58,16 +58,11 @@ class ProcessWalletJournalJob implements ShouldQueue
*/ */
public function handle() public function handle()
{ {
$status = new JobHelper('Process Wallet Journal');
$status->SetStartStatus();
//Declare the class variable we need //Declare the class variable we need
$finance = new FinanceHelper(); $finance = new FinanceHelper();
$finance->GetWalletJournalPage($this->division, $this->charId, $this->page); $finance->GetWalletJournalPage($this->division, $this->charId, $this->page);
$status->SetStopStatus();
//After the job is completed, delete the job //After the job is completed, delete the job
$this->delete(); $this->delete();
} }

View File

@@ -54,16 +54,11 @@ class ProcessWalletTransactionJob implements ShouldQueue
*/ */
public function handle() public function handle()
{ {
$status = new JobHelper('Process Wallet Transaction');
$status->SetStartStatus();
//Declare the class variables //Declare the class variables
$finance = new FinanceHelper(); $finance = new FinanceHelper();
$finance->GetWalletTransaction($this->division, $this->charId); $finance->GetWalletTransaction($this->division, $this->charId);
$status->SetStopStatus();
//After the job is completed, delete the job //After the job is completed, delete the job
$this->delete(); $this->delete();
} }

View File

@@ -15,8 +15,6 @@ use Seat\Eseye\Containers\EsiAuthentication;
use Seat\Eseye\Eseye; use Seat\Eseye\Eseye;
use Seat\Eseye\Exceptions\RequestFailedException; use Seat\Eseye\Exceptions\RequestFailedException;
use App\Jobs\Library\JobHelper;
//Models //Models
use App\Models\Esi\EsiScope; use App\Models\Esi\EsiScope;
use App\Models\Esi\EsiToken; use App\Models\Esi\EsiToken;
@@ -71,9 +69,6 @@ class SendEveMailJob implements ShouldQueue
*/ */
public function handle() public function handle()
{ {
$status = new JobHelper('Send EveMail');
$status->SetStartStatus();
//Retrieve the token for main character to send mails from //Retrieve the token for main character to send mails from
$token = EsiToken::where(['character_id'=> 93738489])->get(); $token = EsiToken::where(['character_id'=> 93738489])->get();
@@ -105,8 +100,6 @@ class SendEveMailJob implements ShouldQueue
return null; return null;
} }
$status->SetStopStatus();
$this->delete(); $this->delete();
} }