DinnerCate.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace app\api\controller\v1;
  3. use app\api\controller\Base;
  4. use app\hander\HelpHander;
  5. class DinnerCate extends Base
  6. {
  7. // 新增
  8. public function save(){
  9. model('DinnerCate')->add();
  10. HelpHander::success([],'操作成功');
  11. }
  12. // 编辑
  13. public function update(){
  14. model('DinnerCate')->add();
  15. HelpHander::success([],'操作成功');
  16. }
  17. public function detail(){
  18. $id = input('id/d',0);
  19. $ret = model('DinnerCate')->info($id);
  20. HelpHander::success($ret);
  21. }
  22. // 列表
  23. public function list(){
  24. $page = input('page/d',1);
  25. $size = input('size/d',10);
  26. $title = input('title','','trim');
  27. $enable = input('enable/d',-1);
  28. $ret = model('DinnerCate')->lists($page,$size,$title,$enable);
  29. HelpHander::success($ret);
  30. }
  31. public function all(){
  32. $ret = model('DinnerCate')->allLists();
  33. HelpHander::success($ret);
  34. }
  35. // 删除
  36. public function del(){
  37. $id = input('id/d',0);
  38. model('DinnerCate')->del($id);
  39. HelpHander::success([],'操作成功');
  40. }
  41. }