Basics.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2017~2024 https://www.yiovo.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
  8. // +----------------------------------------------------------------------
  9. // | Author: 萤火科技 <admin@yiovo.com>
  10. // +----------------------------------------------------------------------
  11. declare (strict_types=1);
  12. namespace app\common\library\printer\engine;
  13. use cores\traits\ErrorTrait;
  14. /**
  15. * 小票打印机驱动基类
  16. * Class Basics
  17. * @package app\common\library\printer\engine
  18. */
  19. abstract class Basics
  20. {
  21. use ErrorTrait;
  22. /**
  23. * 打印机配置
  24. * @var array
  25. */
  26. protected array $config;
  27. /**
  28. * 打印联数(次数)
  29. * @var int
  30. */
  31. protected int $times;
  32. /**
  33. * 构造函数
  34. * Basics constructor.
  35. * @param array $config 打印机配置
  36. * @param int $times 打印联数(次数)
  37. */
  38. public function __construct(array $config, int $times)
  39. {
  40. $this->config = $config;
  41. $this->times = $times;
  42. }
  43. /**
  44. * 执行打印请求
  45. * @param string $content
  46. * @return bool
  47. */
  48. abstract protected function printTicket(string $content): bool;
  49. }