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