正在显示
1 个修改的文件
包含
8 行增加
和
18 行删除
@@ -185,16 +185,11 @@ class Index extends Api | @@ -185,16 +185,11 @@ class Index extends Api | ||
185 | // 哪些人及其下级可查看 | 185 | // 哪些人及其下级可查看 |
186 | if($this->auth->id){ | 186 | if($this->auth->id){ |
187 | $parentsIds = Tree::instance()->init(collection(User::select())->toArray())->getParentsIds($this->auth->id, true); | 187 | $parentsIds = Tree::instance()->init(collection(User::select())->toArray())->getParentsIds($this->auth->id, true); |
188 | - if($parentsIds){ | ||
189 | - foreach ($parentsIds as $pid){ | ||
190 | - $findinset[] = "find_in_set({$pid},user_ids)"; | ||
191 | - } | ||
192 | - $where .= $where ? ' and ' : ''; | ||
193 | - $where .= "(".implode(' or ',$findinset)." or user_ids = '')"; | ||
194 | - }else{ | ||
195 | - // 未设置哪些人及其下级可查看,默认所有人可以查看 | ||
196 | - $where .= " or user_ids = ''"; | 188 | + foreach ($parentsIds as $pid){ |
189 | + $findinset[] = "find_in_set({$pid},user_ids)"; | ||
197 | } | 190 | } |
191 | + $where .= $where ? ' and ' : ''; | ||
192 | + $where .= "(".implode(' or ',$findinset)." or user_ids = '')"; | ||
198 | } | 193 | } |
199 | // 附近 | 194 | // 附近 |
200 | $distance = '1'; | 195 | $distance = '1'; |
@@ -302,16 +297,11 @@ class Index extends Api | @@ -302,16 +297,11 @@ class Index extends Api | ||
302 | // 哪些人及其下级可查看 | 297 | // 哪些人及其下级可查看 |
303 | if($this->auth->id){ | 298 | if($this->auth->id){ |
304 | $parentsIds = Tree::instance()->init(collection(User::select())->toArray())->getParentsIds($this->auth->id, true); | 299 | $parentsIds = Tree::instance()->init(collection(User::select())->toArray())->getParentsIds($this->auth->id, true); |
305 | - if($parentsIds){ | ||
306 | - foreach ($parentsIds as $pid){ | ||
307 | - $findinset[] = "find_in_set({$pid},j.user_ids)"; | ||
308 | - } | ||
309 | - $where .= $where ? ' and ' : ''; | ||
310 | - $where .= "(".implode(' or ',$findinset)." or user_ids = '')"; | ||
311 | - }else{ | ||
312 | - // 未设置哪些人及其下级可查看,默认所有人可以查看 | ||
313 | - $where .= " or user_ids = ''"; | 300 | + foreach ($parentsIds as $pid){ |
301 | + $findinset[] = "find_in_set({$pid},user_ids)"; | ||
314 | } | 302 | } |
303 | + $where .= $where ? ' and ' : ''; | ||
304 | + $where .= "(".implode(' or ',$findinset)." or user_ids = '')"; | ||
315 | } | 305 | } |
316 | 306 | ||
317 | $data = Job::alias('j') | 307 | $data = Job::alias('j') |
-
请 注册 或 登录 后发表评论