1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- <?php
- namespace app\api\controller\v1;
- use app\api\controller\Base;
- use app\hander\HelpHander;
- use think\Db;
- class HouseTurn extends Base
- {
- // 新增
- public function save(){
- model('HouseTurn')->add();
- HelpHander::success([],'操作成功');
- }
- // 删除
- public function del(){
- $id = input('id/d',0);
- model('HouseTurn')->del($id);
- HelpHander::success([],'操作成功');
- }
- // 详情
- public function detail(){
- $id = input('id/d',0);
- $ret = model('HouseTurn')->info($id);
- HelpHander::success($ret);
- }
- //列表
- public function list(){
- $page = input('page/d',1);
- $size = input('size/d',10);
- $title = input('title','','trim');
- $status = input('status/d',-1);
- $enable = input('enable/d',-1);
- $lessee = input('lessee','','trim');
- $vacancy = input('vacancy/d',0);
- $ret = model('HouseTurn')->lists($page,$size,$title,$status,$enable,$lessee,$this->userId,$this->orgId,0,$vacancy);
- HelpHander::success($ret);
- }
- //导出列表
- public function export(){
- $title = input('title','','trim');
- $status = input('status/d',-1);
- $enable = input('enable/d',-1);
- $lessee = input('lessee','','trim');
- $vacancy = input('vacancy/d',0);
- $ret = model('HouseTurn')->export($title,$status,$enable,$lessee,$this->userId,$this->orgId,$vacancy);
- HelpHander::success($ret);
- }
- public function uhlist(){
- $page = input('page/d',1);
- $size = input('size/d',10);
- $title = input('title','','trim');
- $status = input('status/d',-1);
- $lessee = input('lessee','','trim');
- $startTime = input('startTime','','trim');
- $endTime = input('endTime','','trim');
- $ret = model('HouseTurn')->uhlists($page,$size,$title,$status,$lessee,$this->userId,$this->orgId,$startTime,$endTime);
- HelpHander::success($ret);
- }
- public function changeStatus(){
- $id = input('id/d',0);
- $sImg = input('sImg','','trim');
- $sRemark = input('sRemark','','trim');
- if($id <= 0){
- HelpHander::error('参数错误');
- }
- if(!$sImg){
- HelpHander::error('未上传说明文件');
- }
- $ret = model('HouseTurn')->changeStatus($id,$sImg,$sRemark);
- HelpHander::success($ret);
- }
- public function changeType(){
- $id = input('id/d',0);
- $type = input('type/d',0);
- if($id <= 0){
- HelpHander::error('参数错误');
- }
- $ret = Db::name('house_turn')->where('id',$id)->update(['type' => $type]);
- halt($ret);exit();
- if(!$ret){
- HelpHander::error('操作失败');
- }
- HelpHander::success($ret);
- }
- }
|