House.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 House extends Base
  7. {
  8. // 新增/编辑
  9. public function save(){
  10. model('House')->add();
  11. HelpHander::success([],'操作成功');
  12. }
  13. // 详情
  14. public function detail(){
  15. $id = input('id/d',0);
  16. $ret = model('House')->info($id);
  17. HelpHander::success($ret);
  18. }
  19. // 删除
  20. public function del(){
  21. $id = input('id/d',0);
  22. model('House')->del($id);
  23. HelpHander::success([],'操作成功');
  24. }
  25. //列表
  26. public function list(){
  27. $page = input('page/d',1);
  28. $size = input('size/d',10);
  29. $title = input('title','','trim');
  30. $floorId = input('floorId/d',0);
  31. $ret = model('House')->lists($page,$size,$title,$this->userId,$this->orgId,$floorId);
  32. HelpHander::success($ret);
  33. }
  34. public function all(){
  35. $ret = model('House')->all($this->userId,$this->orgId);
  36. HelpHander::success($ret);
  37. }
  38. public function houseList(){
  39. $floorId = input('floorId/d',0);
  40. $title = input('title','','trim');
  41. $ret = model('House')->houseList($floorId,$title,$this->orgId,$this->userId);
  42. HelpHander::success($ret);
  43. }
  44. public function houseDetail(){
  45. $id = input('id/d',0);
  46. $ret = model('House')->houseDetail($id,$this->orgId);
  47. }
  48. }