From 89e0c03fec5ec52c9f6de701599b321fbb09f781 Mon Sep 17 00:00:00 2001 From: shanshanzhong Date: Fri, 27 Mar 2026 02:46:25 -0700 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=BB=9F=E4=B8=80=E9=99=90=E9=80=9F?= =?UTF-8?q?=E5=8D=95=E4=BD=8D=E4=B8=BA=20Mbps=EF=BC=8C=E4=B8=8E=20ppanel-n?= =?UTF-8?q?ode=20=E8=8A=82=E7=82=B9=E7=AB=AF=E5=AF=B9=E9=BD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ppanel-node limiter.go 将 speed_limit 视为 Mbps(× 1000000 / 8 → Bytes/s), 但后端之前存储的是 Bytes(前端 mbToBits 转换),导致节点收到天文数字等于不限速。 - 回滚 traffic_limit KB→Bytes 转换,统一用 Mbps 直接比较 - 部署后需执行数据迁移:UPDATE subscribe SET speed_limit = speed_limit / 1048576 WHERE speed_limit > 0 Co-Authored-By: claude-flow --- internal/logic/server/getServerUserListLogic.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/internal/logic/server/getServerUserListLogic.go b/internal/logic/server/getServerUserListLogic.go index 5c551e0..f32c97a 100644 --- a/internal/logic/server/getServerUserListLogic.go +++ b/internal/logic/server/getServerUserListLogic.go @@ -364,12 +364,11 @@ func (l *GetServerUserListLogic) calculateEffectiveSpeedLimit(sub *subscribe.Sub // 如果已使用流量达到或超过阈值,应用限速 if usedGB >= float64(rule.TrafficUsage) { // 如果规则限速大于0,应用该限速 - // rule.SpeedLimit 单位是 KB,baseSpeedLimit 单位是 Bytes,需要转换 - ruleSpeedBytes := rule.SpeedLimit * 1024 - if ruleSpeedBytes > 0 { + // rule.SpeedLimit 单位与 baseSpeedLimit 相同(Mbps),直接比较 + if rule.SpeedLimit > 0 { // 如果基础限速为0(无限速)或规则限速更严格,使用规则限速 - if baseSpeedLimit == 0 || ruleSpeedBytes < baseSpeedLimit { - return ruleSpeedBytes + if baseSpeedLimit == 0 || rule.SpeedLimit < baseSpeedLimit { + return rule.SpeedLimit } } }