|
|
|
@@ -8,26 +8,25 @@ use Illuminate\Contracts\Queue\ShouldQueue; |
|
|
|
use Illuminate\Foundation\Bus\Dispatchable; |
|
|
|
use Illuminate\Queue\InteractsWithQueue; |
|
|
|
use Illuminate\Queue\SerializesModels; |
|
|
|
use Illuminate\Support\Facades\DB; |
|
|
|
use Illuminate\Support\Facades\Log; |
|
|
|
|
|
|
|
abstract class BaseJob implements ShouldQueue |
|
|
|
{ |
|
|
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; |
|
|
|
|
|
|
|
protected DBUtil $db; |
|
|
|
|
|
|
|
public function handle() |
|
|
|
{ |
|
|
|
$this->db = DBUtil::instance(); |
|
|
|
try { |
|
|
|
$this->db->beginTransaction(); |
|
|
|
DB::beginTransaction(); |
|
|
|
|
|
|
|
$this->logConfig(); |
|
|
|
$this->handleJob(); |
|
|
|
|
|
|
|
$this->db->commit(); |
|
|
|
DB::commit(); |
|
|
|
} catch (Exception $e) { |
|
|
|
$this->db->rollBack(); |
|
|
|
DB::rollBack(); |
|
|
|
throw $e; |
|
|
|
} |
|
|
|
} |
|
|
|
|