diff --git a/application/api/controller/Index.php b/application/api/controller/Index.php index abc74bb..8f03aa9 100644 --- a/application/api/controller/Index.php +++ b/application/api/controller/Index.php @@ -185,16 +185,11 @@ class Index extends Api // 哪些人及其下级可查看 if($this->auth->id){ $parentsIds = Tree::instance()->init(collection(User::select())->toArray())->getParentsIds($this->auth->id, true); - if($parentsIds){ - foreach ($parentsIds as $pid){ - $findinset[] = "find_in_set({$pid},user_ids)"; - } - $where .= $where ? ' and ' : ''; - $where .= "(".implode(' or ',$findinset)." or user_ids = '')"; - }else{ - // 未设置哪些人及其下级可查看,默认所有人可以查看 - $where .= " or user_ids = ''"; + foreach ($parentsIds as $pid){ + $findinset[] = "find_in_set({$pid},user_ids)"; } + $where .= $where ? ' and ' : ''; + $where .= "(".implode(' or ',$findinset)." or user_ids = '')"; } // 附近 $distance = '1'; @@ -302,16 +297,11 @@ class Index extends Api // 哪些人及其下级可查看 if($this->auth->id){ $parentsIds = Tree::instance()->init(collection(User::select())->toArray())->getParentsIds($this->auth->id, true); - if($parentsIds){ - foreach ($parentsIds as $pid){ - $findinset[] = "find_in_set({$pid},j.user_ids)"; - } - $where .= $where ? ' and ' : ''; - $where .= "(".implode(' or ',$findinset)." or user_ids = '')"; - }else{ - // 未设置哪些人及其下级可查看,默认所有人可以查看 - $where .= " or user_ids = ''"; + foreach ($parentsIds as $pid){ + $findinset[] = "find_in_set({$pid},user_ids)"; } + $where .= $where ? ' and ' : ''; + $where .= "(".implode(' or ',$findinset)." or user_ids = '')"; } $data = Job::alias('j')