From ee81d4eee5332dfd309c0470129563622deffda1 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: Wed, 13 Mar 2019 13:18:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B5=81=E9=87=8F=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/db.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/db/db.go b/db/db.go index fde63bc..9256ab8 100644 --- a/db/db.go +++ b/db/db.go @@ -337,8 +337,8 @@ func UpdateTrafficByUser(users map[int]User) { if v.Up+v.Down < 64*1024 { continue } - 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)) + whenUp.WriteString(fmt.Sprintf(" WHEN %v THEN u+%v", v.Port, float32(v.Down)*conf.Rate)) + whenDown.WriteString(fmt.Sprintf(" WHEN %v THEN d+%v", v.Port, float32(v.Up)*conf.Rate)) whenPort.WriteString(fmt.Sprintf("%v,", v.Port)) traffic, err := datasize.HumanSize((v.Up + v.Down) * uint64(conf.Rate)) if err != nil { @@ -365,8 +365,8 @@ func UpdateTrafficByUser(users map[int]User) { portStr := whenPort.String() user := fmt.Sprintf("UPDATE user SET u = CASE port%s END,"+ "d = CASE port%s END,t = unix_timestamp() WHERE port IN (%s)", - whenDown.String(), whenUp.String(), + whenDown.String(), portStr[:len(portStr)-1]) inserStr := insertBuf.String()