OrderExpressJob.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace app\jobs;
  3. use app\services\order\StoreOrderDeliveryServices;
  4. use crmeb\basic\BaseJobs;
  5. use crmeb\traits\QueueTrait;
  6. use think\facade\Log;
  7. class OrderExpressJob extends BaseJobs
  8. {
  9. use QueueTrait;
  10. public function doJob($expressInfo)
  11. {
  12. $id = $expressInfo['id'];
  13. $data = [
  14. 'type' => 1,
  15. 'delivery_name' => $expressInfo['delivery_name'],
  16. 'delivery_code' => $expressInfo['delivery_code'],
  17. 'delivery_id' => $expressInfo['delivery_id'],
  18. 'express_record_type' => 1,
  19. 'express_temp_id' => '',
  20. 'to_name' => '',
  21. 'to_tel' => '',
  22. 'to_addr' => '',
  23. 'sh_delivery_name' => '',
  24. 'sh_delivery_id' => '',
  25. 'sh_delivery_uid' => '',
  26. 'fictitious_content' => '',
  27. 'cart_ids' => [],
  28. 'day_type' => 0,
  29. 'pickup_time' => [],
  30. 'service_type' => '',
  31. ];
  32. try {
  33. app()->make(StoreOrderDeliveryServices::class)->splitDelivery($id, $data, false);
  34. } catch (\Throwable $e) {
  35. Log::error('订单ID' . $id . '发货失败,失败原因:' . $e->getMessage());
  36. }
  37. return true;
  38. }
  39. }