fix v13
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user