<?php

namespace App\Jobs;

use App\Services\OrderPackageReceivedSyncService;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;

/**
 * 同步快递路由信息任务 调用时需要延迟1h触发
 * Class OrderPackageReceivedSync
 * @package App\Jobs
 */
class OrderPackageReceivedSync implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    protected $logisticNumbers;
    protected $service;

    /**
     * OrderPackageReceivedSync constructor.
     * @param $logisticNumbers
     */
    public function __construct($logisticNumbers)
    {
        $this->logisticNumbers = $logisticNumbers;
        $this->service =  new OrderPackageReceivedSyncService();
    }


    /**
     * Execute the job.
     * @return void
     * @throws \Exception
     */
    public function handle()
    {
        $this->service->syncLogisticRouteApi($this->logisticNumbers);
    }
}
