- 优化updateOrderSkuOtherInfo中对于skuID的获取处理
This commit is contained in:
@@ -271,16 +271,11 @@ func (c *OrderManager) updateOrderSkuOtherInfo(order *model.GoodsOrder, db *dao.
|
|||||||
orderSkus := order.Skus
|
orderSkus := order.Skus
|
||||||
|
|
||||||
vendorSkuIDs := make([]int64, 0)
|
vendorSkuIDs := make([]int64, 0)
|
||||||
skuIDMap := make(map[int]int)
|
|
||||||
for _, v := range orderSkus {
|
for _, v := range orderSkus {
|
||||||
intVendorSkuID := utils.Str2Int64WithDefault(v.VendorSkuID, 0)
|
intVendorSkuID := utils.Str2Int64WithDefault(v.VendorSkuID, 0)
|
||||||
if intVendorSkuID != 0 {
|
if intVendorSkuID != 0 {
|
||||||
vendorSkuIDs = append(vendorSkuIDs, intVendorSkuID)
|
vendorSkuIDs = append(vendorSkuIDs, intVendorSkuID)
|
||||||
}
|
}
|
||||||
|
|
||||||
if skuID := jxutils.GetSkuIDFromOrderSku(v); skuID > 0 {
|
|
||||||
skuIDMap[skuID] = 1
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if len(vendorSkuIDs) > 0 {
|
if len(vendorSkuIDs) > 0 {
|
||||||
tableName := "t2"
|
tableName := "t2"
|
||||||
@@ -311,17 +306,7 @@ func (c *OrderManager) updateOrderSkuOtherInfo(order *model.GoodsOrder, db *dao.
|
|||||||
skumapper[v.VendorSkuID] = v
|
skumapper[v.VendorSkuID] = v
|
||||||
}
|
}
|
||||||
|
|
||||||
// var skuPriceMap map[int64]*dao.PromotionStoreSku
|
skuIDMap := make(map[int]int)
|
||||||
var actStoreSkuMap *jxutils.ActStoreSkuMap
|
|
||||||
if len(skuIDMap) > 0 {
|
|
||||||
actStoreSkuList, err := dao.GetEffectiveActStoreSkuInfo(db, 0, []int{order.VendorID}, []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, false)
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, v := range orderSkus {
|
for _, v := range orderSkus {
|
||||||
v.VendorOrderID = order.VendorOrderID
|
v.VendorOrderID = order.VendorOrderID
|
||||||
v.VendorID = order.VendorID
|
v.VendorID = order.VendorID
|
||||||
@@ -342,12 +327,25 @@ func (c *OrderManager) updateOrderSkuOtherInfo(order *model.GoodsOrder, db *dao.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if actStoreSkuMap != nil {
|
if skuID := jxutils.GetSkuIDFromOrderSku(v); skuID > 0 {
|
||||||
if skuID := jxutils.GetSkuIDFromOrderSku(v); skuID > 0 {
|
skuIDMap[skuID] = 1
|
||||||
if actStoreSku := actStoreSkuMap.GetActStoreSku(jxStoreID, skuID, order.VendorID); actStoreSku != nil {
|
}
|
||||||
v.EarningPrice = actStoreSku.EarningPrice
|
}
|
||||||
if true { //v.StoreSubName != "" { // 之前这里为什么要加判断?
|
|
||||||
v.StoreSubID = actStoreSku.ActID
|
if len(skuIDMap) > 0 {
|
||||||
|
actStoreSkuList, err := dao.GetEffectiveActStoreSkuInfo(db, 0, []int{order.VendorID}, []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
|
||||||
|
}
|
||||||
|
if actStoreSkuMap := jxutils.NewActStoreSkuMap(actStoreSkuList, false); actStoreSkuMap != nil {
|
||||||
|
for _, v := range orderSkus {
|
||||||
|
if skuID := jxutils.GetSkuIDFromOrderSku(v); skuID > 0 {
|
||||||
|
if actStoreSku := actStoreSkuMap.GetActStoreSku(jxStoreID, skuID, order.VendorID); actStoreSku != nil {
|
||||||
|
v.EarningPrice = actStoreSku.EarningPrice
|
||||||
|
if true { //v.StoreSubName != "" { // 之前这里为什么要加判断?
|
||||||
|
v.StoreSubID = actStoreSku.ActID
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user