From bfa6ca2b9e9387046c3b4b127064f00c75322aa9 Mon Sep 17 00:00:00 2001 From: gazebo Date: Thu, 29 Aug 2019 17:47:50 +0800 Subject: [PATCH] =?UTF-8?q?-=20CaculateSkuEarningPrice=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=9B=9B=E8=88=8D=E4=BA=94=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxutils/jxutils_cms.go | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) 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