DinnerCompany.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace app\api\controller\v1;
  3. use app\api\controller\Base;
  4. use app\hander\HelpHander;
  5. use think\Db;
  6. class DinnerCompany extends Base
  7. {
  8. // 新增
  9. public function save(){
  10. model('DinnerCompany')->add();
  11. HelpHander::success([],'操作成功');
  12. }
  13. // 编辑
  14. public function update(){
  15. model('DinnerCompany')->add();
  16. HelpHander::success([],'操作成功');
  17. }
  18. public function detail(){
  19. $id = input('id/d',0);
  20. $ret = model('DinnerCompany')->info($id);
  21. HelpHander::success($ret);
  22. }
  23. // 列表
  24. public function list(){
  25. $page = input('page/d',1);
  26. $size = input('size/d',10);
  27. $title = input('title','','trim');
  28. $enable = input('enable/d',-1);
  29. $ret = model('DinnerCompany')->lists($page,$size,$title,$enable);
  30. HelpHander::success($ret);
  31. }
  32. public function all(){
  33. $ret = model('DinnerCompany')->allLists();
  34. HelpHander::success($ret);
  35. }
  36. // 删除
  37. public function del(){
  38. $id = input('id/d',0);
  39. model('DinnerCompany')->del($id);
  40. HelpHander::success([],'操作成功');
  41. }
  42. public function applylimit(){
  43. $vals = Db::name('config')->where('name','dinner_apply_limit')->value('value');
  44. HelpHander::success(['val'=>$vals?$vals:'']);
  45. }
  46. public function aledit(){
  47. $val = input('val','','trim');
  48. $ret = Db::name('config')
  49. ->where('name','dinner_apply_limit')
  50. ->update(['value'=>$val,'update_time'=>date('Y-m-d H:i:s')]);
  51. if($ret){
  52. HelpHander::success([],'操作成功');
  53. }else{
  54. HelpHander::error('操作失败');
  55. }
  56. }
  57. }