- 禁止在老版活动上创建补贴表,迁移至新版,暂时保持活动表的兼容

This commit is contained in:
gazebo
2019-07-25 08:35:30 +08:00
parent 3eb2b1395a
commit db45cf2051
3 changed files with 19 additions and 3 deletions

View File

@@ -287,13 +287,22 @@ func (c *OrderManager) updateOrderSkuOtherInfo(order *model.GoodsOrder, db *dao.
}
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
}
actStoreSkuList, err := dao.GetEffectiveActStoreSkuInfo(db, 0, nil, []int{jxStoreID}, jxutils.IntMap2List(skuIDMap), order.OrderCreatedAt, order.OrderCreatedAt)
if err != nil {
globals.SugarLogger.Errorf("updateOrderSkuOtherInfo can not get sku promotion info for error:%v", err)
return err
}
actStoreSkuMap = jxutils.NewActStoreSkuMap(actStoreSkuList, true)
}
for _, v := range orderSkus {
v.VendorOrderID = order.VendorOrderID
v.VendorID = order.VendorID
@@ -321,6 +330,12 @@ func (c *OrderManager) updateOrderSkuOtherInfo(order *model.GoodsOrder, db *dao.
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
}
}
}
}
}