Basics.php 1007 B

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