added jobs in account check
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use App\Services\Reports\AccountService;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
class AccountCheckJob implements ShouldQueue
|
||||
{
|
||||
use InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
protected $kodcaw;
|
||||
protected $month;
|
||||
protected $jobId;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($kodcaw, $month, $jobId)
|
||||
{
|
||||
$this->kodcaw = $kodcaw;
|
||||
$this->month = $month;
|
||||
$this->jobId = $jobId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$logger = app('job_log');
|
||||
|
||||
try {
|
||||
$check = app(AccountService::class);
|
||||
$test =$check->checkAccount( $this->kodcaw,$this->month);
|
||||
Cache::put("job_result_{$this->jobId}", $test, Carbon::now()->addMinutes(10));
|
||||
Cache::put("job_status_{$this->jobId}", 'completed', Carbon::now()->addMinutes(10));
|
||||
} catch (\Exception $e) {
|
||||
$logger->error($e);
|
||||
throw $e;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user