Browse Source

解决用户名显示错误的Bug

Signed-off-by: zouap <zouap@pcl.ac.cn>
tags/v1.21.12.1^2
zouap 4 years ago
parent
commit
f8af112de8
1 changed files with 2 additions and 11 deletions
  1. +2
    -11
      routers/repo/ai_model_manage.go

+ 2
- 11
routers/repo/ai_model_manage.go View File

@@ -393,8 +393,6 @@ func ShowSingleModel(ctx *context.Context) {

userIds := make([]int64, len(models))
for i, model := range models {
log.Info("model=" + model.Name)
log.Info("model.UserId=" + fmt.Sprint(model.UserId))
model.IsCanOper = isOper(ctx, model.UserId)
userIds[i] = model.UserId
}
@@ -419,13 +417,11 @@ func queryUserName(intSlice []int64) map[int64]*models.User {
uniqueElements = append(uniqueElements, entry)
}
}
uniqueElementsJson, _ := json.Marshal(uniqueElements)
log.Info("uniqueElementsJson=" + string(uniqueElementsJson))
result := make(map[int64]*models.User)
userLists, err := models.GetUsersByIDs(uniqueElements)
if err == nil {
for i, user := range userLists {
result[uniqueElements[i]] = user
for _, user := range userLists {
result[user.ID] = user
}
}

@@ -439,8 +435,6 @@ func ShowOneVersionOtherModel(ctx *context.Context) {

userIds := make([]int64, len(aimodels))
for i, model := range aimodels {
log.Info("model=" + model.Name)
log.Info("model.UserId=" + fmt.Sprint(model.UserId))
model.IsCanOper = isOper(ctx, model.UserId)
userIds[i] = model.UserId
}
@@ -527,9 +521,6 @@ func ShowModelPageInfo(ctx *context.Context) {

userNameMap := queryUserName(userIds)

userNameMapJson, _ := json.Marshal(userNameMap)
log.Info("userNameMapJson=" + string(userNameMapJson))

for _, model := range modelResult {
value := userNameMap[model.UserId]
if value != nil {


Loading…
Cancel
Save