Printer.php 719 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace app\shop\model\settings;
  3. use app\common\model\settings\Printer as PrinterModel;
  4. class Printer extends PrinterModel
  5. {
  6. /**
  7. * 添加新记录
  8. */
  9. public function add($data)
  10. {
  11. $data['printer_config'] = json_encode($data[$data['printer_type']]);
  12. $data['app_id'] = self::$app_id;
  13. return $this->save($data);
  14. }
  15. /**
  16. * 编辑记录
  17. */
  18. public function edit($data)
  19. {
  20. $data['printer_config'] = json_encode($data[$data['printer_type']]);
  21. return $this->save($data);
  22. }
  23. /**
  24. * 删除记录
  25. * @return bool|int
  26. */
  27. public function setDelete()
  28. {
  29. return $this->save(['is_delete' => 1]);
  30. }
  31. }