PrintJob.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2023 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\notice;
  12. use app\services\order\StoreOrderServices;
  13. use crmeb\basic\BaseJobs;
  14. use crmeb\traits\QueueTrait;
  15. use think\facade\Log;
  16. /**
  17. * 小票打印
  18. * Class PrintJob
  19. * @package app\jobs\notice
  20. */
  21. class PrintJob extends BaseJobs
  22. {
  23. use QueueTrait;
  24. /**
  25. * 小票打印
  26. * @param $id
  27. * @return bool|void
  28. */
  29. public function doJob($id)
  30. {
  31. try {
  32. /** @var StoreOrderServices $orderServices */
  33. $orderServices = app()->make(StoreOrderServices::class);
  34. $orderServices->orderPrintTicket((int)$id);
  35. return true;
  36. } catch (\Throwable $e) {
  37. Log::error('小票打印失败失败,失败原因:' . $e->getMessage());
  38. }
  39. }
  40. }