Initial commit

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
fish03
2026-09-23 14:43:16 +07:00
co-authored by Claude Opus 5.5
commit bef9f8b4ed
663 changed files with 81305 additions and 0 deletions
+58
View File
@@ -0,0 +1,58 @@
package web
import (
"strconv"
"videoweb/app/service/playletser"
"videoweb/pub/common/log"
"videoweb/pub/common/useragent"
"github.com/gin-gonic/gin"
)
// UserCenter 个人中心:登录态刷新 getInfo 金币余额,并拉取收藏数量。
func UserCenter(c *gin.Context) {
data := gin.H{
"title": "个人中心",
"navActive": "userCenter",
}
setNoIndex(data, false)
if attachWalletFromGetInfo(c, data) {
RedirectToLogin(c)
return
}
if useragent.TokenFromRequest(c.Request) != "" {
raw, code, err := playletser.FetchCollectList(c, playletser.CollectListQuery{
PageNum: 1,
PageSize: 1,
})
if err != nil {
aborted, retry := AbortSSRIfSessionExpired(c, code)
if aborted {
return
}
if retry {
raw, _, err = playletser.FetchCollectList(c, playletser.CollectListQuery{
PageNum: 1,
PageSize: 1,
})
}
if err != nil {
log.Error("user-center collect count failed", log.E(err))
raw = nil
}
}
count := int64(0)
if raw != nil {
count = raw.TotalCount
}
if count < 0 {
count = 0
}
data["collectCount"] = count
data["collectCountText"] = strconv.FormatInt(count, 10) + "部"
} else {
data["collectCount"] = int64(0)
data["collectCountText"] = "0部"
}
HTMLOK(c, "userCenter.html", data)
}