OrderWriteoffJob.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 app\services\order\StoreOrderWriteOffServices;
  14. use crmeb\basic\BaseJobs;
  15. use crmeb\traits\QueueTrait;
  16. use think\facade\Log;
  17. /**
  18. * 订单核销
  19. * Class OrderWriteoffJob
  20. * @package app\jobs
  21. */
  22. class OrderWriteoffJob extends BaseJobs
  23. {
  24. use QueueTrait;
  25. /**
  26. * 写入核销记录
  27. * @param int $oid
  28. * @param array $cartIds
  29. * @param array $data
  30. * @param array $orderInfo
  31. * @param array $cartInfo
  32. * @return bool
  33. */
  34. public function doJob(int $oid, array $cartIds, array $data, array $orderInfo = [], array $cartInfo = [])
  35. {
  36. try {
  37. /** @var StoreOrderWriteOffServices $storeOrderWriteoffServices */
  38. $storeOrderWriteoffServices = app()->make(StoreOrderWriteOffServices::class);
  39. $storeOrderWriteoffServices->saveWriteOff($oid, $cartIds, $data, $orderInfo, $cartInfo);
  40. } catch (\Throwable $e) {
  41. Log::error('写入订单核销记录失败失败,原因:' . $e->getMessage());
  42. }
  43. return true;
  44. }
  45. }