feat: Admin 设用户等级并展示徽章于用户页
补齐 SetUserLevel 表单;用户主页/资料页展示徽章并触发 EvaluateAuto;勾选 §H Exp 与防刷。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -33,6 +33,7 @@ type profileData struct {
|
||||
Level int
|
||||
Exp int
|
||||
Points int
|
||||
Badges []userPublicBadge
|
||||
PostCount int64
|
||||
CommentCount int64
|
||||
FavoriteCount int64
|
||||
@@ -112,6 +113,14 @@ func (d Deps) renderProfile(ctx *webctx.Context, errMsg string) {
|
||||
AvatarMaxMB: d.Settings.AvatarMaxMB(),
|
||||
SignatureMax: d.Settings.SignatureMax(),
|
||||
}
|
||||
if d.Badge != nil {
|
||||
_ = d.Badge.EvaluateAuto(uid)
|
||||
if rows, err := d.Badge.ListUserBadges(uid); err == nil {
|
||||
for _, v := range services.BadgeViews(rows, 0) {
|
||||
data.Badges = append(data.Badges, userPublicBadge{Name: v.Name, Description: v.Description})
|
||||
}
|
||||
}
|
||||
}
|
||||
if d.Points != nil {
|
||||
data.CheckIn, _ = d.Points.GetCheckInStatus(uid)
|
||||
data.Lottery, _ = d.Points.GetLotteryStatus(uid)
|
||||
|
||||
Reference in New Issue
Block a user