From 96a407d218f34b505960cd3c1302177b4015f118 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, 12 Aug 2020 10:42:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=AC=E8=A5=BF=E6=8A=98=E6=89=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/act/act.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/business/jxstore/act/act.go b/business/jxstore/act/act.go index 1e2253b9b..4aec86064 100644 --- a/business/jxstore/act/act.go +++ b/business/jxstore/act/act.go @@ -1587,6 +1587,27 @@ func ChangeJxPriceByDiscountAct(ctx *jxcontext.Context) { } } else { //第二档时间内 pricePercentage = 0.1 + actualPricePercentage = float64(actStoreSku.OriginalPrice) * (float64(1) - pricePercentage) + //判断活动的折扣类型是最低价还是最低折扣 + if act.DiscountType == model.ActDiscountTypePrice { + minJxPrice = int64(act.DiscountValue2) + } else if act.DiscountType == model.ActDiscountTypePercentage { + minJxPrice = actStoreSku.OriginalPrice * int64(act.DiscountValue2) / 100 + } + if storeSku.JxPrice == int(minJxPrice) { + actStoreSku.TrendType = model.TrendTypeNothing + } else { + actStoreSku.TrendType = model.TrendTypeDown + } + if _, err = dao.UpdateEntity(db, actStoreSku, "TrendType"); err != nil { + dao.Rollback(db) + } + if utils.Float64TwoInt64(float64(storeSku.JxPrice)*actualPricePercentage) <= minJxPrice { + storeSku.JxPrice = int(minJxPrice) + } + if _, err = dao.UpdateEntity(db, storeSku, "JxPrice"); err != nil { + dao.Rollback(db) + } } dao.Commit(db) }