- CaculateSkuEarningPrice支持四舍五入
This commit is contained in:
@@ -1,8 +1,13 @@
|
|||||||
package jxutils
|
package jxutils
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"crypto/md5"
|
"crypto/md5"
|
||||||
|
"encoding/base64"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"image"
|
||||||
|
"image/png"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"math"
|
"math"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -11,26 +16,22 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
"errors"
|
|
||||||
"image"
|
|
||||||
"image/png"
|
|
||||||
"bytes"
|
|
||||||
"encoding/base64"
|
|
||||||
"git.rosy.net.cn/baseapi/platformapi"
|
"git.rosy.net.cn/baseapi/platformapi"
|
||||||
"git.rosy.net.cn/baseapi/utils"
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
"git.rosy.net.cn/jx-callback/business/model"
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||||
"git.rosy.net.cn/jx-callback/globals"
|
"git.rosy.net.cn/jx-callback/globals"
|
||||||
"github.com/boombuler/barcode"
|
"github.com/boombuler/barcode"
|
||||||
"github.com/boombuler/barcode/qr"
|
|
||||||
"github.com/boombuler/barcode/code128"
|
"github.com/boombuler/barcode/code128"
|
||||||
|
"github.com/boombuler/barcode/qr"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
MaxCodeWidth = 400
|
MaxCodeWidth = 400
|
||||||
MaxCodeHeight = 400
|
MaxCodeHeight = 400
|
||||||
CodeTypeQr = "qr"
|
CodeTypeQr = "qr"
|
||||||
CodeTypeBar = "bar"
|
CodeTypeBar = "bar"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -462,7 +463,7 @@ func CaculateSkuEarningPrice(shopPrice, salePrice int64, storePayPercentage int)
|
|||||||
if storePayPercentage <= 0 {
|
if storePayPercentage <= 0 {
|
||||||
storePayPercentage = model.DefaultEarningPricePercentage
|
storePayPercentage = model.DefaultEarningPricePercentage
|
||||||
}
|
}
|
||||||
earningPrice = earningPrice * int64(storePayPercentage) / 100
|
earningPrice = int64(math.Round(float64(earningPrice) * float64(storePayPercentage) / 100))
|
||||||
return earningPrice
|
return earningPrice
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -494,7 +495,7 @@ func CreateQrOrBarCode(width, height int, codeType, srcData string) (imgBase64 s
|
|||||||
code, err = barcode.Scale(code, width, height)
|
code, err = barcode.Scale(code, width, height)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
imgBase64, err = GetImgBase64(code)
|
imgBase64, err = GetImgBase64(code)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return imgBase64, err
|
return imgBase64, err
|
||||||
|
|||||||
Reference in New Issue
Block a user