HouseTurn.php 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 HouseTurn extends Base
  7. {
  8. // 新增
  9. public function save(){
  10. model('HouseTurn')->add();
  11. HelpHander::success([],'操作成功');
  12. }
  13. // 删除
  14. public function del(){
  15. $id = input('id/d',0);
  16. model('HouseTurn')->del($id);
  17. HelpHander::success([],'操作成功');
  18. }
  19. // 详情
  20. public function detail(){
  21. $id = input('id/d',0);
  22. $ret = model('HouseTurn')->info($id);
  23. HelpHander::success($ret);
  24. }
  25. //列表
  26. public function list(){
  27. $page = input('page/d',1);
  28. $size = input('size/d',10);
  29. $title = input('title','','trim');
  30. $status = input('status/d',-1);
  31. $enable = input('enable/d',-1);
  32. $lessee = input('lessee','','trim');
  33. $vacancy = input('vacancy/d',0);
  34. $ret = model('HouseTurn')->lists($page,$size,$title,$status,$enable,$lessee,$this->userId,$this->orgId,0,$vacancy);
  35. HelpHander::success($ret);
  36. }
  37. //导出列表
  38. public function export(){
  39. $title = input('title','','trim');
  40. $status = input('status/d',-1);
  41. $enable = input('enable/d',-1);
  42. $lessee = input('lessee','','trim');
  43. $vacancy = input('vacancy/d',0);
  44. $ret = model('HouseTurn')->export($title,$status,$enable,$lessee,$this->userId,$this->orgId,$vacancy);
  45. HelpHander::success($ret);
  46. }
  47. public function uhlist(){
  48. $page = input('page/d',1);
  49. $size = input('size/d',10);
  50. $title = input('title','','trim');
  51. $status = input('status/d',-1);
  52. $lessee = input('lessee','','trim');
  53. $startTime = input('startTime','','trim');
  54. $endTime = input('endTime','','trim');
  55. $ret = model('HouseTurn')->uhlists($page,$size,$title,$status,$lessee,$this->userId,$this->orgId,$startTime,$endTime);
  56. HelpHander::success($ret);
  57. }
  58. public function changeStatus(){
  59. $id = input('id/d',0);
  60. $sImg = input('sImg','','trim');
  61. $sRemark = input('sRemark','','trim');
  62. if($id <= 0){
  63. HelpHander::error('参数错误');
  64. }
  65. if(!$sImg){
  66. HelpHander::error('未上传说明文件');
  67. }
  68. $ret = model('HouseTurn')->changeStatus($id,$sImg,$sRemark);
  69. HelpHander::success($ret);
  70. }
  71. public function changeType(){
  72. $id = input('id/d',0);
  73. $type = input('type/d',0);
  74. if($id <= 0){
  75. HelpHander::error('参数错误');
  76. }
  77. $ret = Db::name('house_turn')->where('id',$id)->update(['type' => $type]);
  78. halt($ret);exit();
  79. if(!$ret){
  80. HelpHander::error('操作失败');
  81. }
  82. HelpHander::success($ret);
  83. }
  84. }