| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <?php
- namespace App\Jobs;
- use App\DeliveryAppointment;
- use Carbon\Carbon;
- use Illuminate\Bus\Queueable;
- use Illuminate\Contracts\Queue\ShouldQueue;
- use Illuminate\Foundation\Bus\Dispatchable;
- use Illuminate\Queue\InteractsWithQueue;
- use Illuminate\Queue\SerializesModels;
- /**
- * @Deprecated 入库预约自动关单
- */
- class DeliveryAppointmentCheck implements ShouldQueue
- {
- use Dispatchable, InteractsWithQueue, Queueable;
- protected $int;
- /**
- * Create a new job instance.
- *
- * @param int $int
- *
- * @return void
- */
- public function __construct(int $int)
- {
- $this->int = $int;
- }
- /**
- * Execute the job.
- *
- * @return void
- */
- public function handle()
- {
- /** @var DeliveryAppointment|\stdClass $appointment */
- $appointment = DeliveryAppointment::query()->find($this->int);
- $time = explode("-",DeliveryAppointment::PERIOD[$appointment->date_period])[1];
- if ($appointment && $appointment->status==0
- && Carbon::now()->gt(Carbon::parse($appointment->appointment_date." ".$time.":00:00"))
- )$appointment->update(["status"=>3]);
- }
- }
|