From 8ef38feb915d1996504771b87a21ee972d832fb8 Mon Sep 17 00:00:00 2001 From: suyl <770236076@qq.com> Date: Wed, 21 Jul 2021 14:37:03 +0800 Subject: [PATCH] aa --- dao/dao.go | 2 ++ utils/utils.go | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dao/dao.go b/dao/dao.go index d05c8b4..81338b5 100644 --- a/dao/dao.go +++ b/dao/dao.go @@ -49,6 +49,8 @@ func Insert(db *sqlx.DB, obj interface{}) (err error) { sql.WriteString("?") } sql.WriteString(")") + fmt.Println(sql.String()) + fmt.Println(sqlParams) _, err = db.DB.Exec(sql.String(), sqlParams...) return err } diff --git a/utils/utils.go b/utils/utils.go index 2582233..cc5ac24 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -10,7 +10,6 @@ import ( "git.rosy.net.cn/jx-print/model" "github.com/dchest/captcha" "github.com/gin-gonic/gin" - "math" "math/rand" "net/http" "strings" @@ -240,11 +239,11 @@ func FlowKB2Other(flowKB float64) (flow float64, unit string) { if flowKB < 1024 { return flowKB, "KB" } else { - flowMB := math.Round(flowKB / float64(1024)) + flowMB := utils.Str2Float64(fmt.Sprintf("%.2f", flowKB/float64(1024))) if flowMB < 1024 { return flowMB, "MB" } else { - flowGB := math.Round(flowMB / float64(1024)) + flowGB := utils.Str2Float64(fmt.Sprintf("%.2f", flowMB/float64(1024))) if flowGB < 1024 { return flowGB, "GB" }