job library
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -58,16 +58,11 @@ class ProcessWalletJournalJob implements ShouldQueue
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$status = new JobHelper('Process Wallet Journal');
|
||||
$status->SetStartStatus();
|
||||
|
||||
//Declare the class variable we need
|
||||
$finance = new FinanceHelper();
|
||||
|
||||
$finance->GetWalletJournalPage($this->division, $this->charId, $this->page);
|
||||
|
||||
$status->SetStopStatus();
|
||||
|
||||
//After the job is completed, delete the job
|
||||
$this->delete();
|
||||
}
|
||||
|
||||
@@ -54,16 +54,11 @@ class ProcessWalletTransactionJob implements ShouldQueue
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$status = new JobHelper('Process Wallet Transaction');
|
||||
$status->SetStartStatus();
|
||||
|
||||
//Declare the class variables
|
||||
$finance = new FinanceHelper();
|
||||
|
||||
$finance->GetWalletTransaction($this->division, $this->charId);
|
||||
|
||||
$status->SetStopStatus();
|
||||
|
||||
//After the job is completed, delete the job
|
||||
$this->delete();
|
||||
}
|
||||
|
||||
@@ -15,8 +15,6 @@ use Seat\Eseye\Containers\EsiAuthentication;
|
||||
use Seat\Eseye\Eseye;
|
||||
use Seat\Eseye\Exceptions\RequestFailedException;
|
||||
|
||||
use App\Jobs\Library\JobHelper;
|
||||
|
||||
//Models
|
||||
use App\Models\Esi\EsiScope;
|
||||
use App\Models\Esi\EsiToken;
|
||||
@@ -71,9 +69,6 @@ class SendEveMailJob implements ShouldQueue
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$status = new JobHelper('Send EveMail');
|
||||
$status->SetStartStatus();
|
||||
|
||||
//Retrieve the token for main character to send mails from
|
||||
$token = EsiToken::where(['character_id'=> 93738489])->get();
|
||||
|
||||
@@ -104,9 +99,7 @@ class SendEveMailJob implements ShouldQueue
|
||||
} catch(RequestFailedException $e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$status->SetStopStatus();
|
||||
|
||||
|
||||
$this->delete();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user