This commit is contained in:
苏尹岚
2021-01-20 14:18:15 +08:00
parent 4f61f1f35d
commit c9f9c435d5

View File

@@ -163,6 +163,7 @@ func UpdateUserRole(ctx *jxcontext.Context, userIDs []string, roleIDs []int) (er
userRoleMap[v.UserID] = append(userRoleMap[v.UserID], v.RoleID) userRoleMap[v.UserID] = append(userRoleMap[v.UserID], v.RoleID)
} }
} }
fmt.Println("userRoleMap", userRoleMap)
for _, userID := range userIDs { for _, userID := range userIDs {
nowRoleIDs := userRoleMap[userID] nowRoleIDs := userRoleMap[userID]
for _, nowRoleID := range nowRoleIDs { for _, nowRoleID := range nowRoleIDs {
@@ -171,6 +172,7 @@ func UpdateUserRole(ctx *jxcontext.Context, userIDs []string, roleIDs []int) (er
} }
nowRoleIDMap[nowRoleID] = 1 nowRoleIDMap[nowRoleID] = 1
} }
fmt.Println("nowRoleIDMap", nowRoleIDMap)
for _, roleID := range roleIDMap { for _, roleID := range roleIDMap {
if nowRoleIDMap[roleID] == 0 { if nowRoleIDMap[roleID] == 0 {
addUserRoleMap[userID] = append(addUserRoleMap[userID], roleID) addUserRoleMap[userID] = append(addUserRoleMap[userID], roleID)