fix(分组): 防止降级环并校验上下文分组

- 增加降级链路环检测并拦截配置

- 仅复用合法分组上下文并必要时回退查询

- 标注 GetByIDLite 轻量语义并补充测试
This commit is contained in:
yangjianbo
2026-01-10 07:56:50 +08:00
parent 675543240e
commit 2597fe78ba
8 changed files with 210 additions and 14 deletions

View File

@@ -179,7 +179,7 @@ func GetSubscriptionFromContext(c *gin.Context) (*service.UserSubscription, bool
}
func setGroupContext(c *gin.Context, group *service.Group) {
if group == nil {
if !service.IsGroupContextValid(group) {
return
}
if existing, ok := c.Request.Context().Value(ctxkey.Group).(*service.Group); ok && existing != nil && existing.ID == group.ID {