OrderCloseJob.php 1004 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace App\Jobs;
  3. use App\Exceptions\ApiException;
  4. use App\Services\Pay\OrderService;
  5. use Illuminate\Bus\Queueable;
  6. use Illuminate\Queue\SerializesModels;
  7. use Illuminate\Queue\InteractsWithQueue;
  8. use Illuminate\Contracts\Queue\ShouldQueue;
  9. use Illuminate\Foundation\Bus\Dispatchable;
  10. /**
  11. * Class OrderCloseJob
  12. * @package App\Jobs
  13. */
  14. class OrderCloseJob implements ShouldQueue
  15. {
  16. use Dispatchable;
  17. use InteractsWithQueue;
  18. use Queueable;
  19. use SerializesModels;
  20. /**
  21. * Create a new job instance.
  22. *
  23. * @param int $order_id
  24. */
  25. public function __construct($order_id)
  26. {
  27. $this->order_id = $order_id;
  28. }
  29. private $order_id;
  30. /**
  31. * Execute the job.
  32. *
  33. * @return void
  34. */
  35. public function handle()
  36. {
  37. $orderService = new OrderService();
  38. try {
  39. $result = $orderService->closeOrder($this->order_id);
  40. } catch (ApiException $e) {
  41. } catch (\Exception $e) {
  42. }
  43. }
  44. }