|
@@ -86,25 +86,32 @@ func (c *CurrentUser) EntInfo(userId string, entId int) *CurrentUser {
|
|
|
if phone == "" {
|
|
|
return currentUser
|
|
|
}
|
|
|
- //角色、权限
|
|
|
- r := Mysql.SelectBySql(`SELECT b.role_id,c.dept_id,d.name as dept_name,d.subdis as dept_subdis from entniche_user a
|
|
|
- LEFT JOIN entniche_user_role b on (a.id=b.user_id)
|
|
|
- LEFT JOIN entniche_department_user c on (a.id=c.user_id)
|
|
|
- LEFT JOIN entniche_department d on (d.ent_id=? and c.dept_id=d.id)
|
|
|
- where a.ent_id=? and a.phone=? order by a.id desc`, entId, entId, phone)
|
|
|
- if r != nil && len(*r) > 0 {
|
|
|
- role_id := qutil.IntAll((*r)[0]["role_id"])
|
|
|
- if role_id == Role_admin_department {
|
|
|
- currentUser.Role_admin_department = true
|
|
|
- }
|
|
|
- currentUser.Dept.Id = qutil.IntAll((*r)[0]["dept_id"])
|
|
|
- currentUser.Dept.Name = (*r)[0]["dept_name"].(string)
|
|
|
- currentUser.Dept.Subdis = qutil.IntAll((*r)[0]["dept_subdis"])
|
|
|
- }
|
|
|
- //
|
|
|
currentUser.Ent = VarEntInfo.GetById(entId)
|
|
|
if currentUser.Ent.Phone == phone {
|
|
|
currentUser.Role_admin_system = true
|
|
|
+ r := Mysql.SelectBySql(`SELECT id,name,subdis from entniche_department where ent_id=? and pid=0`, entId)
|
|
|
+ if r != nil && len(*r) > 0 {
|
|
|
+ department := JsonUnmarshal((*r)[0], &Department{}).(*Department)
|
|
|
+ if department != nil {
|
|
|
+ currentUser.Dept = department
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //角色、权限
|
|
|
+ r := Mysql.SelectBySql(`SELECT b.role_id,c.dept_id,d.name as dept_name,d.subdis as dept_subdis from entniche_user a
|
|
|
+ LEFT JOIN entniche_user_role b on (a.id=b.user_id)
|
|
|
+ LEFT JOIN entniche_department_user c on (a.id=c.user_id)
|
|
|
+ LEFT JOIN entniche_department d on (d.ent_id=? and c.dept_id=d.id)
|
|
|
+ where a.ent_id=? and a.phone=? order by a.id desc`, entId, entId, phone)
|
|
|
+ if r != nil && len(*r) > 0 {
|
|
|
+ role_id := qutil.IntAll((*r)[0]["role_id"])
|
|
|
+ if role_id == Role_admin_department {
|
|
|
+ currentUser.Role_admin_department = true
|
|
|
+ }
|
|
|
+ currentUser.Dept.Id = qutil.IntAll((*r)[0]["dept_id"])
|
|
|
+ currentUser.Dept.Name = (*r)[0]["dept_name"].(string)
|
|
|
+ currentUser.Dept.Subdis = qutil.IntAll((*r)[0]["dept_subdis"])
|
|
|
+ }
|
|
|
}
|
|
|
return currentUser
|
|
|
}
|