This commit is contained in:
tamakyi
2026-10-19 01:58:00 +08:00
parent bd613a6f5a
commit 4592b6ef24
14 changed files with 608 additions and 244 deletions
+14
View File
@@ -294,6 +294,20 @@ func ShareCard(ctx context.Context) {
return
}
// 站方处置:任何级别都不再生成整箱分享图(与单题分享卡一致)。
// 放在缓存之前 —— 拦截必须即时生效,否则处置后 30 分钟内仍能拿到旧图。
// DB 异常时按已处置处理(fail-closed):这张图会带上箱主信息与二维码,是外传载体。
if level, _, err := db.Restrictions.ActiveLevel(ctx.Request().Context(), user.ID); err != nil {
logrus.WithContext(ctx.Request().Context()).WithError(err).Error("Failed to query user restriction")
ctx.Redirect("/")
return
} else if level != "" {
logrus.WithContext(ctx.Request().Context()).WithField("domain", domain).WithField("level", level).
Info("Profile share card blocked by restriction")
ctx.Redirect("/")
return
}
// 命中缓存直接返回,避免重复下载图片与重新绘制
cacheKey := shareCardCacheKey(user)
if cached, ok := shareCardCache.Get(cacheKey); ok {