From 34903a3cd1a2e1d684dba03031a6dba0c024eca6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Wed, 19 Feb 2020 16:46:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E4=BB=B7=E4=BF=9D=E7=95=99?= =?UTF-8?q?=E5=88=B0=E6=AF=9B=EF=BC=8C=E6=B4=BB=E5=8A=A8=E4=BB=B7=E4=B8=8D?= =?UTF-8?q?=E5=8F=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/act/act.go | 4 ++-- business/jxutils/jxutils_cms.go | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/business/jxstore/act/act.go b/business/jxstore/act/act.go index ab59b78c4..5cd8e4116 100644 --- a/business/jxstore/act/act.go +++ b/business/jxstore/act/act.go @@ -253,7 +253,7 @@ func ActStoreSkuParam2Model(ctx *jxcontext.Context, db *dao.DaoDB, act *model.Ac if v.PricePercentage != 0 { percentage = v.PricePercentage } - actSkuMap.ActualActPrice = int64(jxutils.CaculateSkuVendorPrice(int(actSkuMap.VendorPrice), percentage, 0)) + actSkuMap.ActualActPrice = int64(jxutils.CaculateSkuActVendorPrice(int(actSkuMap.VendorPrice), percentage, 0)) if actSkuMap.ActualActPrice > 10 { actSkuMap.ActualActPrice = int64(math.Floor(float64(actSkuMap.ActualActPrice)/10) * 10) } @@ -596,7 +596,7 @@ func CreateAct(ctx *jxcontext.Context, act *model.Act, vendorIDs []int, vendorOr _, err = SyncAct(ctx, task, actID, nil, false) return retVal, err }, neeSyncActIDs) - + tasksch.HandleTask(task, nil, true).Run() if !isAsync { hint = utils.Int2Str(act.ID) diff --git a/business/jxutils/jxutils_cms.go b/business/jxutils/jxutils_cms.go index 774fe54a3..ebf749df0 100644 --- a/business/jxutils/jxutils_cms.go +++ b/business/jxutils/jxutils_cms.go @@ -259,9 +259,19 @@ func ConstrainPricePercentage(percentage int) int { return percentage } +func CaculateSkuActVendorPrice(price, percentage, priceAdd int) (vendorPrice int) { + percentage = ConstrainPricePercentage(percentage) + vendorPrice = int(math.Round(float64(price*percentage)/100)) + priceAdd + if vendorPrice < 1 { + vendorPrice = 1 + } + return vendorPrice +} + func CaculateSkuVendorPrice(price, percentage, priceAdd int) (vendorPrice int) { percentage = ConstrainPricePercentage(percentage) vendorPrice = int(math.Round(float64(price*percentage)/100)) + priceAdd + vendorPrice = int(math.Ceil(float64(vendorPrice)/10) * 10) if vendorPrice < 1 { vendorPrice = 1 }