Printer.php 914 B

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