- 去掉对于GetPromotionSkuPriceMap的使用

This commit is contained in:
gazebo
2019-07-25 17:21:59 +08:00
parent 83e7af3ba2
commit f21666e6bd
2 changed files with 25 additions and 23 deletions

View File

@@ -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

View File

@@ -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)
}