From f6aaceee62ef09aba962f67ac188aa896d64ceab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=A5=E5=B0=98=EF=BC=88=E6=A8=B1=E3=81=AE=E6=B3=AA?= =?UTF-8?q?=EF=BC=89?= Date: Tue, 15 Jan 2019 13:09:48 +0800 Subject: [PATCH] fix: traffic record rate --- db/db.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/db.go b/db/db.go index 1d58b30..5cddf7b 100644 --- a/db/db.go +++ b/db/db.go @@ -233,8 +233,8 @@ func UpdateTrafficByUser(users map[int]User) { if v.Up+v.Down < 512*1024 { continue } - whenUp.WriteString(fmt.Sprintf(" WHEN %v THEN u+%v", v.Port, v.Up)) - whenDown.WriteString(fmt.Sprintf(" WHEN %v THEN d+%v", v.Port, v.Down)) + whenUp.WriteString(fmt.Sprintf(" WHEN %v THEN u+%v", v.Port, float32(v.Up)*conf.Rate)) + whenDown.WriteString(fmt.Sprintf(" WHEN %v THEN d+%v", v.Port, float32(v.Down)*conf.Rate)) whenPort.WriteString(fmt.Sprintf("%v,", v.Port)) traffic, err := datasize.HumanSize(v.Up + v.Down) if err != nil {