Printer.php 805 B

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