Эх сурвалжийг харах

refactor(service): 调整带宽限制和全局限制配置- 将 100m 带宽限制调整为12.5m
- 修改全局限制配置中的 Bps值为原值除以 16

fusu 1 сар өмнө
parent
commit
d725f9135f

+ 2 - 2
internal/service/formatter.go

@@ -128,7 +128,7 @@ func (service *formatterService) OldFormat(ctx context.Context, req *[]model.Gam
 			v.SdkIp = ""
 		}
 		if v.MaxBandwidth == 1 {
-			MaxBandwidth = "100m"
+			MaxBandwidth = "12.5m"
 		} else {
 			MaxBandwidth = ""
 		}
@@ -212,7 +212,7 @@ func (service *formatterService) TidyFormatBackendData(ctx context.Context, req
 			}
 
 			if pointer.GetInt(item.MaxBandwidth) == 1 {
-				itemMap.MaxBandwidth = "100m"
+				itemMap.MaxBandwidth = "12.5m"
 			} else {
 				itemMap.MaxBandwidth = ""
 			}

+ 1 - 1
internal/service/gameshieldbackend.go

@@ -276,7 +276,7 @@ func (s *gameShieldBackendService) SaveGameShieldBackend(ctx context.Context, re
 		if v.Type != "pc" {
 			v.SdkIp = "127.0.0.1"
 		}
-		if v.MaxBandwidth == "100m" {
+		if v.MaxBandwidth == "12.5m" {
 			v.MaxBandwidth = "1"
 		} else {
 			v.MaxBandwidth = "0"

+ 6 - 1
internal/service/globallimit.go

@@ -82,7 +82,12 @@ func (s *globalLimitService) GlobalLimitRequire(ctx context.Context, req v1.Glob
 		return v1.GlobalLimitRequireResponse{}, fmt.Errorf("获取配置限制失败: %w", err)
 	}
 
-	res.Bps = configCount.Bps
+	bpsInt, err := strconv.Atoi(configCount.Bps)
+	if err != nil {
+		return v1.GlobalLimitRequireResponse{}, err
+	}
+	res.Bps = strconv.Itoa(bpsInt / 2 / 8)
+
 	res.MaxBytesMonth = configCount.MaxBytesMonth
 	res.Operator = configCount.Operator
 	res.IpCount = configCount.IpCount