Dinner.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. namespace app\api\controller\v1;
  3. use app\api\controller\Base;
  4. use app\hander\HelpHander;
  5. class Dinner extends Base
  6. {
  7. // 新增
  8. public function save(){
  9. model('Dinner')->add();
  10. HelpHander::success([],'操作成功');
  11. }
  12. // 编辑
  13. public function update(){
  14. model('Dinner')->add();
  15. HelpHander::success([],'操作成功');
  16. }
  17. public function detail(){
  18. $id = input('id/d',0);
  19. $ret = model('Dinner')->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('Dinner')->lists($page,$size,$title,$enable);
  29. HelpHander::success($ret);
  30. }
  31. public function getlistday(){
  32. $day = input('day','','trim');
  33. $ret = model('Dinner')->getlistday($day);
  34. HelpHander::success($ret);
  35. }
  36. // 删除
  37. public function del(){
  38. $id = input('id/d',0);
  39. model('Dinner')->del($id);
  40. HelpHander::success([],'操作成功');
  41. }
  42. public function cateList(){
  43. $ret = model('DinnerCate')->getList();
  44. HelpHander::success($ret);
  45. }
  46. }