From 0b4f04c33cd4bab9a75b604381de01c5952cc4b1 Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Wed, 23 Jul 2025 10:57:51 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=87=AA=E5=AE=9A=E4=B9=89=E6=8C=87?= =?UTF-8?q?=E6=A0=87=E6=95=B0=E6=8D=AE=E8=AE=A1=E7=AE=97=E5=B0=8F=E4=BA=8E?= =?UTF-8?q?0=E5=B0=B1=E5=BC=BA=E5=88=B6=E4=B8=BA0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/oam/service/kpi.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/modules/oam/service/kpi.go b/src/modules/oam/service/kpi.go index 3d73d8c4..832f4c7d 100644 --- a/src/modules/oam/service/kpi.go +++ b/src/modules/oam/service/kpi.go @@ -183,11 +183,14 @@ func (s *KPI) saveKPIDataC(k oam.KPI, index int64) error { item["err"] = err.Error() } else { if v.Unit == "%" { - resultInt64 := parse.Number(result) - if resultInt64 > 100 { + resultV, ok := result.(float64) + if !ok { + resultV = 0 + } + if resultV > 100 { result = 100 } - if resultInt64 < 0 { + if resultV < 0 { result = 0 } }