Browse Source

代码提交。

Signed-off-by: zouap <zouap@pcl.ac.cn>
tags/v1.22.9.2^2
zouap 3 years ago
parent
commit
d840f32655
2 changed files with 8 additions and 0 deletions
  1. +1
    -0
      models/user_invitation.go
  2. +7
    -0
      routers/user/Invitation.go

+ 1
- 0
models/user_invitation.go View File

@@ -13,6 +13,7 @@ type Invitation struct {
SrcUserID int64 `xorm:"NOT NULL DEFAULT 0"`
UserID int64 `xorm:"NOT NULL DEFAULT 0"`
Phone string `xorm:"INDEX"`
Avatar string `xorm:"-"`
CreatedUnix timeutil.TimeStamp `xorm:"created"`
}



+ 7
- 0
routers/user/Invitation.go View File

@@ -2,6 +2,7 @@ package user

import (
"errors"
"strconv"
"strings"

"code.gitea.io/gitea/models"
@@ -43,6 +44,12 @@ func GetInvitaionCode(ctx *context.Context) {
if ctx.IsSigned {
resultJsonMap["invitation_code"] = getInvitaionCode(ctx)
re, count := models.QueryInvitaionBySrcUserId(ctx.User.ID, (page-1)*pageSize, pageSize)
for _, record := range re {
tmpUser, err := models.GetUserByID(record.UserID)
if err == nil {
record.Avatar = strings.TrimRight(setting.AppSubURL, "/") + "/user/avatar/" + tmpUser.Name + "/" + strconv.Itoa(-1)
}
}
resultJsonMap["invitation_users"] = re
resultJsonMap["invitation_users_count"] = count
}


Loading…
Cancel
Save