|
...
|
...
|
@@ -11,6 +11,8 @@ class ManageHr extends Base |
|
|
|
const GID_ZERO = 0;//超级管理员
|
|
|
|
|
|
|
|
const STATUS_ONE = 1;
|
|
|
|
|
|
|
|
const IS_LEADER = 1;//组长
|
|
|
|
/**
|
|
|
|
* 特殊字段
|
|
|
|
* @return string[]
|
|
...
|
...
|
@@ -202,4 +204,32 @@ class ManageHr extends Base |
|
|
|
}
|
|
|
|
return $name;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :根据当前用户登录的id获取当前用户的组长
|
|
|
|
* @name :accordIdGetLeader
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2025/7/22 9:42
|
|
|
|
* @param :id->当前用户的人事id
|
|
|
|
*/
|
|
|
|
public function accordIdGetLeader($id = 0){
|
|
|
|
if(empty($id)){
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
//查看当前用户是否为组长
|
|
|
|
$info = $this->read(['id'=>$id],['belong_group','name','is_leader','dept_id','nickname']);
|
|
|
|
if($info === false){
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
//不是组长:根据小组获取组长
|
|
|
|
if($info['is_leader'] != self::IS_LEADER){
|
|
|
|
$id = $this->getValue(['belong_group'=>$info['belong_group'],'is_leader'=> self::IS_LEADER]);
|
|
|
|
if(empty($id)){
|
|
|
|
//未获取到时,根据当前大组去随机获取一个组长
|
|
|
|
$id = $this->getValue(['dept_id'=>$info['dept_id'],'is_leader'=> self::IS_LEADER]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $id;
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|