// +---------------------------------------------------------------------- namespace app\jobs\order; use app\services\order\StoreOrderStatusServices; use app\services\order\StoreOrderTakeServices; use crmeb\basic\BaseJobs; use crmeb\traits\QueueTrait; use think\facade\Log; /** * 订单收货任务 * Class OrderTakeJob * @package app\jobs */ class OrderTakeJob extends BaseJobs { use QueueTrait; /** * @return string */ protected static function queueName() { return 'CRMEB_PRO_TASK'; } public function doJob($order) { if (!$order) return true; /** @var StoreOrderTakeServices $service */ $service = app()->make(StoreOrderTakeServices::class); /** @var StoreOrderStatusServices $statusService */ $statusService = app()->make(StoreOrderStatusServices::class); $res = $service->update($order['id'], ['status' => 2]) && $statusService->save([ 'oid' => $order['id'], 'change_type' => 'user_take_delivery', 'change_message' => '用户已收货', 'change_time' => time() ]); $order = $service->get((int)$order['id']); $res = $res && $service->storeProductOrderUserTakeDelivery($order); if (!$res) { Log::error('收货失败:' . $order['order_id']); } return true; } }