Basics.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /**
  3. *
  4. * @copyright ©2020 点小铺
  5. * @author hanj
  6. * @link: https://dyuit.com
  7. * Created by VSCode
  8. */
  9. namespace app\common\library\printer\engine;
  10. /**
  11. * 小票打印机驱动基类
  12. * Class Basics
  13. * @package app\common\library\printer\engine
  14. */
  15. abstract class Basics
  16. {
  17. protected $config; // 打印机配置
  18. protected $times; // 打印联数(次数)
  19. protected $error; // 错误信息
  20. /**
  21. * 构造函数
  22. * Basics constructor.
  23. * @param array $config 打印机配置
  24. * @param int $times 打印联数(次数)
  25. */
  26. public function __construct($config, $times)
  27. {
  28. $this->config = $config;
  29. $this->times = $times;
  30. }
  31. /**
  32. * 执行打印请求
  33. * @param $content
  34. * @return mixed
  35. */
  36. abstract protected function printTicket($content);
  37. /**
  38. * 返回错误信息
  39. * @return mixed
  40. */
  41. public function getError()
  42. {
  43. return $this->error;
  44. }
  45. /**
  46. * 创建打印的内容
  47. * @return string
  48. */
  49. private function setContentText()
  50. {
  51. return '';
  52. }
  53. }