diff --git a/relay/relay_task.go b/relay/relay_task.go index 04a905c7..61588f93 100644 --- a/relay/relay_task.go +++ b/relay/relay_task.go @@ -150,6 +150,14 @@ func RelayTaskSubmit(c *gin.Context, info *relaycommon.RelayInfo) (taskErr *dto. } } + // 处理 auto 分组:从 context 获取实际选中的分组 + // 当使用 auto 分组时,Distribute 中间件会将实际选中的分组存储在 ContextKeyAutoGroup 中 + if autoGroup, exists := common.GetContextKey(c, constant.ContextKeyAutoGroup); exists { + if groupStr, ok := autoGroup.(string); ok && groupStr != "" { + info.UsingGroup = groupStr + } + } + // 预扣 groupRatio := ratio_setting.GetGroupRatio(info.UsingGroup) var ratio float64