From 5e7c921b83707a38480816740bf81793eee5f150 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 Aug 2020 13:58:06 +0800 Subject: [PATCH] =?UTF-8?q?8=E7=82=B9=E5=90=8E=E4=B9=9F=E8=A6=81=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E5=AE=88=E4=BB=B7=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/act/act.go | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/business/jxstore/act/act.go b/business/jxstore/act/act.go index 68cf61571..48344d6a4 100644 --- a/business/jxstore/act/act.go +++ b/business/jxstore/act/act.go @@ -1570,6 +1570,15 @@ func ChangeJxPriceByDiscountAct(ctx *jxcontext.Context) { // storeSku.JxPrice = storeSku.JxPrice + int(actualPrice) } else if actStoreSkuMap.TrendType == model.TrendTypeDown { actStoreSkuMap.ActualActPrice = actStoreSkuMap.ActualActPrice - actualPrice + //判断活动的折扣类型是最低价还是最低折扣(第一档) + if act.DiscountType == model.ActDiscountTypePrice { + minJxPrice = int64(act.DiscountValue1) + } else if act.DiscountType == model.ActDiscountTypePercentage { + minJxPrice = actStoreSkuMap.VendorPrice * int64(act.DiscountValue1) / 100 + } + if actStoreSkuMap.ActualActPrice <= minJxPrice { + actStoreSkuMap.ActualActPrice = minJxPrice + } // storeSku.JxPrice = storeSku.JxPrice - int(actualPrice) stock := checkPriceDefendOrderByPrice(db, storeSku.StoreID, storeSku.SkuID, storeSku.Stock, int(actStoreSkuMap.ActualActPrice)) if stock != -1 { @@ -1582,15 +1591,6 @@ func ChangeJxPriceByDiscountAct(ctx *jxcontext.Context) { if actStoreSkuMap.ActualActPrice >= actStoreSkuMap.VendorPrice { actStoreSkuMap.ActualActPrice = actStoreSkuMap.VendorPrice } - //判断活动的折扣类型是最低价还是最低折扣(第一档) - if act.DiscountType == model.ActDiscountTypePrice { - minJxPrice = int64(act.DiscountValue1) - } else if act.DiscountType == model.ActDiscountTypePercentage { - minJxPrice = actStoreSkuMap.VendorPrice * int64(act.DiscountValue1) / 100 - } - if actStoreSkuMap.ActualActPrice <= minJxPrice { - actStoreSkuMap.ActualActPrice = minJxPrice - } // if _, err = dao.UpdateEntity(db, actStoreSkuMap, "ActualActPrice"); err != nil { // dao.Rollback(db) // } @@ -1628,6 +1628,13 @@ func ChangeJxPriceByDiscountAct(ctx *jxcontext.Context) { if actStoreSkuMap.ActualActPrice <= minJxPrice { actStoreSkuMap.ActualActPrice = minJxPrice } + stock := checkPriceDefendOrderByPrice(db, storeSku.StoreID, storeSku.SkuID, storeSku.Stock, int(actStoreSkuMap.ActualActPrice)) + if stock != -1 { + storeSku.Stock = stock + if _, err = dao.UpdateEntity(db, storeSku, "Stock"); err != nil { + dao.Rollback(db) + } + } //22:00 恢复库存为100,价格恢复原价 if time.Now().Hour() == 22 && time.Now().Minute() < 1 { storeSku.Stock = 100