OrderInvoiceJob.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2026 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;
  12. use app\services\order\StoreOrderInvoiceServices;
  13. use crmeb\basic\BaseJobs;
  14. use crmeb\traits\QueueTrait;
  15. class OrderInvoiceJob extends BaseJobs
  16. {
  17. use QueueTrait;
  18. /**
  19. * 自动开票队列
  20. * @param $id
  21. * @return bool
  22. * @author wuhaotian
  23. * @email 442384644@qq.com
  24. * @date 2024/5/16
  25. */
  26. public function autoInvoice($id)
  27. {
  28. try {
  29. if (sys_config('elec_invoice', 1) != 1) {
  30. return true;
  31. }
  32. /** @var StoreOrderInvoiceServices $services */
  33. $services = app()->make(StoreOrderInvoiceServices::class);
  34. $services->invoiceIssuance($id);
  35. } catch (\Exception $e) {
  36. }
  37. return true;
  38. }
  39. /**
  40. * 自动冲红队列
  41. * @param $id
  42. * @return bool
  43. * @author wuhaotian
  44. * @email 442384644@qq.com
  45. * @date 2024/5/16
  46. */
  47. public function autoInvoiceRed($id)
  48. {
  49. try {
  50. if (sys_config('elec_invoice', 1) != 1) {
  51. return true;
  52. }
  53. /** @var StoreOrderInvoiceServices $services */
  54. $services = app()->make(StoreOrderInvoiceServices::class);
  55. $services->redInvoiceIssuance($id);
  56. } catch (\Exception $e) {
  57. }
  58. return true;
  59. }
  60. }