<?php
 namespace TechSoft\Laravel\Shop\Util; use TechOnline\Laravel\Dao\ModelUtil; use TechSoft\Laravel\Shop\Jobs\OrderWorkerJob; use TechSoft\Laravel\Shop\Types\OrderWorkerStatus; use Illuminate\Foundation\Bus\DispatchesJobs; class OrderWorkerUtil { use DispatchesJobs; private static function instance() { static $instance = null; if (null === $instance) { return new OrderWorkerUtil(); } return $instance; } public static function put($orderId, $orderGoodsId, $worker, $remark = null) { $data = []; $data['orderId'] = $orderId; $data['orderGoodsId'] = $orderGoodsId; $data['worker'] = $worker; $data['remark'] = $remark; $data['status'] = OrderWorkerStatus::WAIT_START; $data = ModelUtil::insert('order_worker', $data); $job = new OrderWorkerJob(); $job->id = $data['id']; self::instance()->dispatch($job); } }