OrderDeliveryJob.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\jobs\order;
  12. use app\services\order\StoreOrderDeliveryServices;
  13. use crmeb\basic\BaseJobs;
  14. use crmeb\traits\QueueTrait;
  15. use think\facade\Log;
  16. /**
  17. * 订单发货
  18. * Class OrderDeliveryJob
  19. * @package app\jobs
  20. */
  21. class OrderDeliveryJob extends BaseJobs
  22. {
  23. use QueueTrait;
  24. /**
  25. * 确认收货
  26. * @param $orderInfo
  27. * @param $data
  28. * @param $type
  29. * @return bool
  30. */
  31. public function doJob($orderInfo, $data, $type)
  32. {
  33. try {
  34. /** @var StoreOrderDeliveryServices $storeOrderDeliveryServices */
  35. $storeOrderDeliveryServices = app()->make(StoreOrderDeliveryServices::class);
  36. $data['type'] = $type;
  37. $storeOrderDeliveryServices->doDelivery((int)$orderInfo['id'], $orderInfo, $data);
  38. } catch (\Throwable $e) {
  39. Log::error('收银台订单自动发货失败,原因:' . $e->getMessage());
  40. }
  41. return true;
  42. }
  43. }