mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-04-18 17:47:27 +00:00
refactor(group): update user group handling to utilize userUsableGroups directly and add GetUserGroupRatio function
This commit is contained in:
@@ -29,11 +29,11 @@ func GetUserGroups(c *gin.Context) {
|
||||
userId := c.GetInt("id")
|
||||
userGroup, _ = model.GetUserGroup(userId, false)
|
||||
userUsableGroups := service.GetUserUsableGroups(userGroup)
|
||||
for groupName, ratio := range ratio_setting.GetGroupRatioCopy() {
|
||||
for groupName, _ := range ratio_setting.GetGroupRatioCopy() {
|
||||
// UserUsableGroups contains the groups that the user can use
|
||||
if desc, ok := userUsableGroups[groupName]; ok {
|
||||
usableGroups[groupName] = map[string]interface{}{
|
||||
"ratio": ratio,
|
||||
"ratio": service.GetUserGroupRatio(userGroup, groupName),
|
||||
"desc": desc,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user