DeliveryAppointmentCheck.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace App\Jobs;
  3. use App\DeliveryAppointment;
  4. use Carbon\Carbon;
  5. use Illuminate\Bus\Queueable;
  6. use Illuminate\Contracts\Queue\ShouldQueue;
  7. use Illuminate\Foundation\Bus\Dispatchable;
  8. use Illuminate\Queue\InteractsWithQueue;
  9. use Illuminate\Queue\SerializesModels;
  10. /**
  11. * @Deprecated 入库预约自动关单
  12. */
  13. class DeliveryAppointmentCheck implements ShouldQueue
  14. {
  15. use Dispatchable, InteractsWithQueue, Queueable;
  16. protected $int;
  17. /**
  18. * Create a new job instance.
  19. *
  20. * @param int $int
  21. *
  22. * @return void
  23. */
  24. public function __construct(int $int)
  25. {
  26. $this->int = $int;
  27. }
  28. /**
  29. * Execute the job.
  30. *
  31. * @return void
  32. */
  33. public function handle()
  34. {
  35. /** @var DeliveryAppointment|\stdClass $appointment */
  36. $appointment = DeliveryAppointment::query()->find($this->int);
  37. $time = explode("-",DeliveryAppointment::PERIOD[$appointment->date_period])[1];
  38. if ($appointment && $appointment->status==0
  39. && Carbon::now()->gt(Carbon::parse($appointment->appointment_date." ".$time.":00:00"))
  40. )$appointment->update(["status"=>3]);
  41. }
  42. }