-
Notifications
You must be signed in to change notification settings - Fork 0
/
ProcessarCobrancaJob.php
executable file
·55 lines (42 loc) · 1.18 KB
/
ProcessarCobrancaJob.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
namespace App\Jobs;
use App\Services\CobrancaService;
use Illuminate\Support\Facades\Log;
class ProcessarCobrancaJob extends Job
{
public $tries = 200;
public $timeout = 21600;
private $idImportacaoSalva;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct(int $idImportacaoSalva)
{
LOG::info('ProcessarCobrancaJob::__construct');
$this->idImportacaoSalva = $idImportacaoSalva;
}
/**
* Execute the job.
*
* @return void
*/
public function handle(CobrancaService $cobrancaService)
{
LOG::info('ProcessarCobrancaJob::handle');
try{
$resJob = $cobrancaService->processCobranca($this->idImportacaoSalva);
$sitJob = $resJob ? "Rodou com sucesso" : "Problema ao rodar JOB";
LOG::info($sitJob);
}catch(\Exception $e){
$res = [
'File' => $e->getFile(),
'Msg' => $e->getMessage(),
'Line' => $e->getLine(),
'Code' => $e->getCode()
];
LOG::error('Error: '.json_encode($res));
}
}
}