diff --git a/application/api/controller/User.php b/application/api/controller/User.php index 3d31084..90bd8d6 100644 --- a/application/api/controller/User.php +++ b/application/api/controller/User.php @@ -1597,18 +1597,22 @@ class User extends Api $page_num = $this->request->param('page_num', 10, 'intval'); $is_work = $this->request->param('is_work'); //是否在职:0=否,1=是 $keyword = $this->request->param('keyword'); -// $where['pid'] = $user['id']; //下一级 - // 下二级 - $xia_ids = $this->model - ->where('pid',$user['id']) - ->column('id'); - if(!empty($xia_ids)){ - $xia_xia_ids = $this->model - ->where('pid','in',$xia_ids) + if ($user['lower_num'] == 1){ + $where['pid'] = $user['id']; //下一级 + } + if ($user['lower_num'] == 2){ + // 下二级 + $xia_ids = $this->model + ->where('pid',$user['id']) ->column('id'); - $xia_ids = $xia_xia_ids ? array_merge($xia_ids,$xia_xia_ids) : $xia_ids; + if(!empty($xia_ids)){ + $xia_xia_ids = $this->model + ->where('pid','in',$xia_ids) + ->column('id'); + $xia_ids = $xia_xia_ids ? array_merge($xia_ids,$xia_xia_ids) : $xia_ids; + } + $where['id'] = $xia_ids ? ['in',$xia_ids] : 0; } - $where['id'] = $xia_ids ? ['in',$xia_ids] : 0; if($is_work != ''){ $where['is_work'] = $is_work; }