diff --git a/business/jxutils/jxutils_cms.go b/business/jxutils/jxutils_cms.go index a35725f67..b0b365efe 100644 --- a/business/jxutils/jxutils_cms.go +++ b/business/jxutils/jxutils_cms.go @@ -1,8 +1,13 @@ package jxutils import ( + "bytes" "crypto/md5" + "encoding/base64" + "errors" "fmt" + "image" + "image/png" "io/ioutil" "math" "net/http" @@ -11,26 +16,22 @@ import ( "strings" "sync" "time" - "errors" - "image" - "image/png" - "bytes" - "encoding/base64" + "git.rosy.net.cn/baseapi/platformapi" "git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/jx-callback/business/model" "git.rosy.net.cn/jx-callback/business/model/dao" "git.rosy.net.cn/jx-callback/globals" "github.com/boombuler/barcode" - "github.com/boombuler/barcode/qr" "github.com/boombuler/barcode/code128" + "github.com/boombuler/barcode/qr" ) const ( MaxCodeWidth = 400 MaxCodeHeight = 400 - CodeTypeQr = "qr" - CodeTypeBar = "bar" + CodeTypeQr = "qr" + CodeTypeBar = "bar" ) var ( @@ -462,7 +463,7 @@ func CaculateSkuEarningPrice(shopPrice, salePrice int64, storePayPercentage int) if storePayPercentage <= 0 { storePayPercentage = model.DefaultEarningPricePercentage } - earningPrice = earningPrice * int64(storePayPercentage) / 100 + earningPrice = int64(math.Round(float64(earningPrice) * float64(storePayPercentage) / 100)) return earningPrice } @@ -494,7 +495,7 @@ func CreateQrOrBarCode(width, height int, codeType, srcData string) (imgBase64 s code, err = barcode.Scale(code, width, height) if err == nil { imgBase64, err = GetImgBase64(code) - } + } } return imgBase64, err