feat: SSR 内容门控与积分钱包/签到抽奖

闭合积分解锁经济闭环:锁定壳与 unlock,以及 profile 钱包流水与每日签到/抽奖 PRG。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-29 06:20:12 +08:00
parent 40ec20b3df
commit 204e7fdb32
20 changed files with 818 additions and 107 deletions

View File

@@ -23,6 +23,7 @@ type Deps struct {
Limiter *services.RateLimiter
EmailCode *services.EmailCodeService
Store *services.UploadStore
Points *services.PointsService
}
// BoardView 侧栏
@@ -47,7 +48,8 @@ type PageChrome struct {
CSRF string
Flash string
Error string
UnreadCount int64 // 登录用户未读私信/通知总数;未登录为 0
UnreadCount int64 // 登录用户未读私信/通知总数;未登录为 0
ViewerPoints int // 登录用户当前积分;未登录为 0
}
func (d Deps) ctx(c *gin.Context) *webctx.Context {
@@ -78,20 +80,25 @@ func (d Deps) chrome(ctx *webctx.Context, title, desc, inner string) PageChrome
if ctx.IsSigned() && d.Message != nil {
unread, _ = d.Message.UnreadCount(ctx.UserID())
}
viewerPoints := 0
if ctx.IsSigned() && ctx.Doer != nil {
viewerPoints = ctx.Doer.Points
}
return PageChrome{
Title: title,
Description: desc,
SiteName: brand.Name,
Slogan: brand.Slogan,
LogoMark: firstRuneOr(brand.LogoMark, "姜"),
LoggedIn: ctx.IsSigned(),
IsAdmin: ctx.IsAdmin(),
ViewerName: name,
Boards: bv,
Inner: inner,
CSRF: ctx.EnsureCSRF(),
Flash: ctx.TakeFlash(),
UnreadCount: unread,
Title: title,
Description: desc,
SiteName: brand.Name,
Slogan: brand.Slogan,
LogoMark: firstRuneOr(brand.LogoMark, "姜"),
LoggedIn: ctx.IsSigned(),
IsAdmin: ctx.IsAdmin(),
ViewerName: name,
Boards: bv,
Inner: inner,
CSRF: ctx.EnsureCSRF(),
Flash: ctx.TakeFlash(),
UnreadCount: unread,
ViewerPoints: viewerPoints,
}
}