Browse Source

Merge pull request '解决:#1086, 后端返回界面编辑权限的界面是否可以操作。' (#1093) from zouap into V20211213

Reviewed-on: https://git.openi.org.cn/OpenI/aiforge/pulls/1093
Reviewed-by: lewis <747342561@qq.com>
tags/v1.21.12.1^2
lewis 4 years ago
parent
commit
8469ae6ee0
1 changed files with 16 additions and 0 deletions
  1. +16
    -0
      routers/repo/ai_model_manage.go

+ 16
- 0
routers/repo/ai_model_manage.go View File

@@ -391,6 +391,22 @@ func ShowSingleModel(ctx *context.Context) {
log.Info("Show single ModelInfo start.name=" + name)
models := models.QueryModelByName(name, ctx.Repo.Repository.ID)

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
}
userNameMap := queryUserName(userIds)

for _, model := range models {
value := userNameMap[model.UserId]
if value != nil {
model.UserName = value.Name
model.UserRelAvatarLink = value.RelAvatarLink()
}
}
ctx.JSON(http.StatusOK, models)
}



Loading…
Cancel
Save