fix: add load_factor upper bound validation to BulkUpdateAccounts

This commit is contained in:
erio
2026-03-06 05:17:52 +08:00
parent 18f2e21414
commit af3a5076d6

View File

@@ -1635,7 +1635,13 @@ func (s *adminServiceImpl) BulkUpdateAccounts(ctx context.Context, input *BulkUp
repoUpdates.RateMultiplier = input.RateMultiplier repoUpdates.RateMultiplier = input.RateMultiplier
} }
if input.LoadFactor != nil { if input.LoadFactor != nil {
repoUpdates.LoadFactor = input.LoadFactor if *input.LoadFactor <= 0 {
repoUpdates.LoadFactor = nil // 0 或负数表示清除
} else if *input.LoadFactor > 10000 {
return nil, errors.New("load_factor must be <= 10000")
} else {
repoUpdates.LoadFactor = input.LoadFactor
}
} }
if input.Status != "" { if input.Status != "" {
repoUpdates.Status = &input.Status repoUpdates.Status = &input.Status