123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
- namespace app\bug\controller;
- use app\bug\model\Moudel;use think\App;
- class Model extends Base
- {
- public function __construct(App $app)
- {
- parent::__construct($app);
- $this->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);
- }
- }
|