| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 | <?phpnamespace App\Jobs;use App\Service\Order\OrderTagService;use Illuminate\Bus\Queueable;use Illuminate\Contracts\Queue\ShouldQueue;use Illuminate\Foundation\Bus\Dispatchable;use Illuminate\Queue\InteractsWithQueue;use Illuminate\Queue\SerializesModels;use Illuminate\Support\Facades\DB;class OrderTag implements ShouldQueue{    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;    protected $order_no;    /**     * Create a new job instance.     *     * @return void     */    public function __construct($order_no)    {        //        $this->order_no = $order_no;    }    /**     * Execute the job.     *     * @return void     */    public function handle()    {        //生成芯片数据更新订单产品部件信息        $service = new OrderTagService();        DB::beginTransaction();        try{            $service = $service->setTag($this->order_no);            DB::commit();        }catch (\Exception $e){            DB::rollBack();            $this->dispatch($this->order_no);        }    }}
 |