model=new Moudel(); } public function list(){ $param = $this->request->param(["name"=>"","pid"=>"","level"=>"","status"=>"","company_type"=>""],"post","trim"); $where=[["is_del","=",0],["status","=",1]]; if($param['name']!==""){ $where[]=["name","like","%{$param['name']}%"]; } if($param['pid']!==""){ $where[]=["pid","=",$param['pid']]; } if($param['level']!==""){ $where[]=["level","=",$param['level']]; } if ($param['status']!==""){ $where[]=["status","=",$param['status']]; } if ($param['company_type']!==""){ $where[]=["company_type","=",$param['company_type']]; } $list = $this->model->where($where)->order("weight desc")->select(); $data=[]; foreach ($list as $value){ $temp = $this->model->where(['pid'=>$value['id'],'is_del'=>0,"status"=>1])->order("weight desc") ->select(); $value['child']=$temp; $data[]=$value; } return success("获取成功",$data); } }