// +---------------------------------------------------------------------- namespace app\jobs\order; use app\services\order\StoreOrderStatusServices; use crmeb\basic\BaseJobs; use crmeb\traits\QueueTrait; /** * Class OrderStatusJob * @package app\jobs\order */ class OrderStatusJob extends BaseJobs { use QueueTrait; /** * 写入订单记录 * @param $type * @param $orderId * @param $data * @return bool */ public function doJob($type, $orderId, $data = []) { if (!$type || !$orderId) { return true; } try { /** @var StoreOrderStatusServices $statusService */ $statusService = app()->make(StoreOrderStatusServices::class); $statusService->saveStatus((string)$type, (int)$orderId, (array)$data); } catch (\Throwable $e) { response_log_write([ 'message' => '写入订单【'.$type.'】记录失败,失败原因:' . $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine() ]); } return true; } }