Преглед изворни кода

refactor(internal/service): 优化全球限流速度单位和格式

- 将全球限流速度的单位从 bps 改为 Mbps- 优化了代码格式,调整了 BanUdp 字段的对齐
fusu пре 1 месец
родитељ
комит
e1ae2c9fd7
1 измењених фајлова са 2 додато и 2 уклоњено
  1. 2 2
      internal/service/globallimit.go

+ 2 - 2
internal/service/globallimit.go

@@ -86,7 +86,7 @@ func (s *globalLimitService) GlobalLimitRequire(ctx context.Context, req v1.Glob
 	if err != nil {
 		return v1.GlobalLimitRequireResponse{}, err
 	}
-	res.Bps = strconv.Itoa(bpsInt / 2 / 8)
+	res.Bps = strconv.Itoa(bpsInt / 2.0 / 8.0) + "M"
 
 	res.MaxBytesMonth = configCount.MaxBytesMonth
 	res.Operator = configCount.Operator
@@ -218,7 +218,7 @@ func (s *globalLimitService) AddGlobalLimit(ctx context.Context, req v1.GlobalLi
 		HostId:          req.HostId,
 		RuleId:          cast.ToInt(ruleId),
 		Uid:             req.Uid,
-		BanUdp:           0,
+		BanUdp:          0,
 		GlobalLimitName: require.GlobalLimitName,
 		Comment:         req.Comment,
 		TcpLimitRuleId:  tcpLimitRuleId,