LogisticSFSync.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace App\Jobs;
  3. use App\Services\LogisticSFService;
  4. use Illuminate\Bus\Queueable;
  5. use Illuminate\Contracts\Queue\ShouldQueue;
  6. use Illuminate\Foundation\Bus\Dispatchable;
  7. use Illuminate\Queue\InteractsWithQueue;
  8. use Illuminate\Queue\SerializesModels;
  9. class LogisticSFSync implements ShouldQueue
  10. {
  11. use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
  12. public $logistic_number;
  13. /**
  14. * @var LogisticSFService $logisticSFService
  15. */
  16. public $logisticSFService;
  17. public $orderPackageReceivedSyncService;
  18. /**
  19. * LogisticSFSync constructor.
  20. * @param $logistic_number
  21. */
  22. public function __construct($logistic_number)
  23. {
  24. $this->logistic_number = $logistic_number;
  25. }
  26. /**
  27. * Execute the job.
  28. *
  29. * @return void
  30. * @throws \Exception
  31. */
  32. public function handle()
  33. {
  34. ini_set('max_execution_time', 60);
  35. $this->logisticSFService = app('LogisticSFService');
  36. $formedData = $this->logisticSFService->get([$this->logistic_number]);
  37. $this->orderPackageReceivedSyncService = app('OrderPackageReceivedSyncService');
  38. $this->orderPackageReceivedSyncService->update($formedData);
  39. }
  40. }