CreateInvoiceJob.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\StoreOrderInvoiceServices;
  13. use crmeb\basic\BaseJobs;
  14. use crmeb\traits\QueueTrait;
  15. use think\facade\Log;
  16. /**
  17. * 支付成功自动发送卡密
  18. * Class OrderSendCardJob
  19. * @package app\jobs\order
  20. */
  21. class CreateInvoiceJob extends BaseJobs
  22. {
  23. use QueueTrait;
  24. /**
  25. * @param $orderInfo
  26. * @return bool
  27. */
  28. public function doJob(int $uid, int $order_id, $invoice_id)
  29. {
  30. if (!$uid || !$order_id || !$invoice_id) {
  31. return true;
  32. }
  33. try {
  34. //创建开票数据
  35. /** @var StoreOrderInvoiceServices $storeOrderInvoiceServices */
  36. $storeOrderInvoiceServices = app()->make(StoreOrderInvoiceServices::class);
  37. $storeOrderInvoiceServices->makeUp($uid, $order_id, $invoice_id);
  38. } catch (\Throwable $e) {
  39. Log::error('创建订单发票信息失败失败,原因:' . $e->getMessage());
  40. }
  41. return true;
  42. }
  43. }