|
@@ -246,9 +246,24 @@ class ConsultantService
|
|
*/
|
|
*/
|
|
public static function userList()
|
|
public static function userList()
|
|
{
|
|
{
|
|
- $deptIds = SysDept::where('dept_category', '=', '获客团队')->pluck('dept_id');
|
|
|
|
- $deptIds = $deptIds->toArray();
|
|
|
|
- $userList = SysUser::whereIn('join_user_dept_id', $deptIds)->select(['user_id', 'user_name', 'user_mobile'])->get();
|
|
|
|
|
|
+ $deptIds = TeamService::getIdsByUser();
|
|
|
|
+ $where = [];
|
|
|
|
+ if (false === $deptIds) {
|
|
|
|
+ //无权限
|
|
|
|
+ $where[] = ['join_user_dept_id', '=', 0];
|
|
|
|
+ } else if (is_array($deptIds)) {
|
|
|
|
+ //指定团队下的权限
|
|
|
|
+ $where[] = [function($query) use ($deptIds) {
|
|
|
|
+ $query->whereIn('join_user_dept_id', $deptIds);
|
|
|
|
+ }];
|
|
|
|
+ } else {
|
|
|
|
+ $deptIds = SysDept::where('dept_category', '=', '获客团队')->pluck('dept_id');
|
|
|
|
+ $deptIds = $deptIds->toArray();
|
|
|
|
+ $where[] = [function($query) use ($deptIds) {
|
|
|
|
+ $query->whereIn('join_user_dept_id', $deptIds);
|
|
|
|
+ }];
|
|
|
|
+ }
|
|
|
|
+ $userList = SysUser::where($where)->select(['user_id', 'user_name', 'user_mobile'])->get();
|
|
return json_success('请求成功', $userList);
|
|
return json_success('请求成功', $userList);
|
|
}
|
|
}
|
|
|
|
|