|
|
|
@@ -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) |
|
|
|
} |
|
|
|
|
|
|
|
|