12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
- // +----------------------------------------------------------------------
- // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
- // +----------------------------------------------------------------------
- // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
- // +----------------------------------------------------------------------
- // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
- // +----------------------------------------------------------------------
- // | Author: CRMEB Team <admin@crmeb.com>
- // +----------------------------------------------------------------------
- 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;
- }
- }
|