From f21666e6bd11a4d2445bd2397bad4efa2882c7f1 Mon Sep 17 00:00:00 2001 From: gazebo Date: Thu, 25 Jul 2019 17:21:59 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E5=8E=BB=E6=8E=89=E5=AF=B9=E4=BA=8EGetProm?= =?UTF-8?q?otionSkuPriceMap=E7=9A=84=E4=BD=BF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 29 ++++++++++++++------------- business/jxstore/cms/store_sku.go | 19 +++++++++--------- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index a69753b3b..17834f633 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -286,14 +286,14 @@ func (c *OrderManager) updateOrderSkuOtherInfo(order *model.GoodsOrder, db *dao. skumapper[v.VendorSkuID] = v } - var skuPriceMap map[int64]*dao.PromotionStoreSku + // var skuPriceMap map[int64]*dao.PromotionStoreSku var actStoreSkuMap *jxutils.ActStoreSkuMap if len(skuIDMap) > 0 { - skuPriceMap, err = dao.GetPromotionSkuPriceMap(db, model.VendorIDJX, []int{jxStoreID}, jxutils.IntMap2List(skuIDMap), order.OrderCreatedAt, order.OrderCreatedAt) - if err != nil { - globals.SugarLogger.Errorf("updateOrderSkuOtherInfo can not get sku promotion info for orderID:%s, error:%v", order.VendorOrderID, err) - return err - } + // skuPriceMap, err = dao.GetPromotionSkuPriceMap(db, model.VendorIDJX, []int{jxStoreID}, jxutils.IntMap2List(skuIDMap), order.OrderCreatedAt, order.OrderCreatedAt) + // if err != nil { + // globals.SugarLogger.Errorf("updateOrderSkuOtherInfo can not get sku promotion info for orderID:%s, error:%v", order.VendorOrderID, err) + // return err + // } actStoreSkuList, err := dao.GetEffectiveActStoreSkuInfo(db, 0, []int{order.VendorID}, []int{jxStoreID}, jxutils.IntMap2List(skuIDMap), order.OrderCreatedAt, order.OrderCreatedAt) if err != nil { @@ -323,14 +323,15 @@ func (c *OrderManager) updateOrderSkuOtherInfo(order *model.GoodsOrder, db *dao. } } - if skuPriceMap != nil { - if skuID := jxutils.GetSkuIDFromOrderSku(v); skuID > 0 /*&& v.StoreSubName != ""*/ { - index := dao.GenSkuPriceMapKey(jxStoreID, v.SkuID) - if skuPriceMap[index] != nil && skuPriceMap[index].EarningPrice > 0 { - v.EarningPrice = int64(skuPriceMap[index].EarningPrice) - } - } - } else if actStoreSkuMap != nil { + // if skuPriceMap != nil { + // if skuID := jxutils.GetSkuIDFromOrderSku(v); skuID > 0 /*&& v.StoreSubName != ""*/ { + // index := dao.GenSkuPriceMapKey(jxStoreID, v.SkuID) + // if skuPriceMap[index] != nil && skuPriceMap[index].EarningPrice > 0 { + // v.EarningPrice = int64(skuPriceMap[index].EarningPrice) + // } + // } + // } else + if actStoreSkuMap != nil { if skuID := jxutils.GetSkuIDFromOrderSku(v); skuID > 0 /*&& v.StoreSubName != ""*/ { if actStoreSku := actStoreSkuMap.GetActStoreSku(jxStoreID, skuID, order.VendorID); actStoreSku != nil { v.EarningPrice = actStoreSku.EarningPrice diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 5bebe5e23..773b248ac 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -489,11 +489,11 @@ func GetStoreAndSkuIDsFromInfo(skuNamesInfo *StoreSkuNamesInfo) (storeIDs, skuID // } func updateActPrice4StoreSkuNameNew(db *dao.DaoDB, storeIDs, skuIDs []int, skuNamesInfo *StoreSkuNamesInfo) (err error) { - jxSkuPriceMap, err := dao.GetPromotionSkuPriceMap(db, model.VendorIDJX, storeIDs, skuIDs, time.Now(), time.Now()) - if err != nil { - globals.SugarLogger.Errorf("updateActPrice4StoreSkuNameNew can not get sku promotion info for error:%v", err) - return err - } + // jxSkuPriceMap, err := dao.GetPromotionSkuPriceMap(db, model.VendorIDJX, storeIDs, skuIDs, time.Now(), time.Now()) + // if err != nil { + // globals.SugarLogger.Errorf("updateActPrice4StoreSkuNameNew can not get sku promotion info for error:%v", err) + // return err + // } actStoreSkuList, err := dao.GetEffectiveActStoreSkuInfo(db, 0, nil, storeIDs, skuIDs, time.Now(), time.Now()) if err != nil { @@ -509,10 +509,11 @@ func updateActPrice4StoreSkuNameNew(db *dao.DaoDB, storeIDs, skuIDs []int, skuNa if actStoreSku != nil { v.ActPrice = int(actStoreSku.ActualActPrice) } - index := dao.GenSkuPriceMapKey(skuName.StoreID, v.SkuID) - if jxSkuPriceMap[index] != nil { - v.EarningPrice = jxSkuPriceMap[index].EarningPrice - } else if actStoreSku != nil { + // index := dao.GenSkuPriceMapKey(skuName.StoreID, v.SkuID) + // if jxSkuPriceMap[index] != nil { + // v.EarningPrice = jxSkuPriceMap[index].EarningPrice + // } else + if actStoreSku != nil { v.EarningPrice = int(actStoreSku.EarningPrice) }