This commit is contained in:
suyl
2021-07-21 14:37:03 +08:00
parent 90234c4112
commit 8ef38feb91
2 changed files with 4 additions and 3 deletions

View File

@@ -49,6 +49,8 @@ func Insert(db *sqlx.DB, obj interface{}) (err error) {
sql.WriteString("?") sql.WriteString("?")
} }
sql.WriteString(")") sql.WriteString(")")
fmt.Println(sql.String())
fmt.Println(sqlParams)
_, err = db.DB.Exec(sql.String(), sqlParams...) _, err = db.DB.Exec(sql.String(), sqlParams...)
return err return err
} }

View File

@@ -10,7 +10,6 @@ import (
"git.rosy.net.cn/jx-print/model" "git.rosy.net.cn/jx-print/model"
"github.com/dchest/captcha" "github.com/dchest/captcha"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"math"
"math/rand" "math/rand"
"net/http" "net/http"
"strings" "strings"
@@ -240,11 +239,11 @@ func FlowKB2Other(flowKB float64) (flow float64, unit string) {
if flowKB < 1024 { if flowKB < 1024 {
return flowKB, "KB" return flowKB, "KB"
} else { } else {
flowMB := math.Round(flowKB / float64(1024)) flowMB := utils.Str2Float64(fmt.Sprintf("%.2f", flowKB/float64(1024)))
if flowMB < 1024 { if flowMB < 1024 {
return flowMB, "MB" return flowMB, "MB"
} else { } else {
flowGB := math.Round(flowMB / float64(1024)) flowGB := utils.Str2Float64(fmt.Sprintf("%.2f", flowMB/float64(1024)))
if flowGB < 1024 { if flowGB < 1024 {
return flowGB, "GB" return flowGB, "GB"
} }