【查询用户信息赋值默认角色】

This commit is contained in:
weizhihong 2023-09-01 17:34:41 +08:00
parent d4a2074aab
commit a327bea53b

View File

@ -54,8 +54,8 @@ func FindUserInfo(userId int32) *dto.UserRspDto {
} }
rspUser := dto.ConvertFromUserDto(user) rspUser := dto.ConvertFromUserDto(user)
roles := QueryAuthRoleByUid(user.ID) roles := QueryAuthRoleByUid(user.ID)
if len(roles) == 0 { if len(roles) == 0 { // 如果没有指派用户时,指定普通用户信息
return rspUser roles = []*model.AuthRole{{ID: int32(dto.USER), Name: "普通用户"}}
} }
rids := make([]int32, len(roles)) rids := make([]int32, len(roles))
for i, r := range roles { for i, r := range roles {