- up
This commit is contained in:
@@ -89,8 +89,15 @@ func ActStoreSkuParam2Model(ctx *jxcontext.Context, db *dao.DaoDB, act *model.Ac
|
||||
skuIDMap[v.SkuID] = 1
|
||||
storeSkuParamMap[v.StoreID] = append(storeSkuParamMap[v.StoreID], v)
|
||||
}
|
||||
storeIDs := jxutils.IntMap2List(storeIDMap)
|
||||
skuIDs := jxutils.IntMap2List(skuIDMap)
|
||||
// effectActStoreSkuList, err := dao.GetEffectiveActStoreSkuInfo(db, 0, nil, storeIDs, skuIDs, time.Now(), time.Now())
|
||||
// if err != nil {
|
||||
// globals.SugarLogger.Errorf("updateActPrice4StoreSkuNameNew can not get sku promotion info for error:%v", err)
|
||||
// return nil, nil, nil, err
|
||||
// }
|
||||
|
||||
storeSkuList, err2 := dao.GetStoresSkusInfo(db, jxutils.IntMap2List(storeIDMap), jxutils.IntMap2List(skuIDMap))
|
||||
storeSkuList, err2 := dao.GetStoresSkusInfo(db, storeIDs, skuIDs)
|
||||
if err = err2; err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
|
||||
@@ -484,6 +484,49 @@ func updateActPrice4StoreSkuName(db *dao.DaoDB, storeIDs, skuIDs []int, skuNames
|
||||
return err
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
actStoreSkuList, err := dao.GetEffectiveActStoreSkuInfo(db, 0, nil, 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
|
||||
}
|
||||
actStoreSkuMap := make(map[int64]*model.ActStoreSku2)
|
||||
for _, v := range actStoreSkuList {
|
||||
index := jxutils.Combine2Int(v.StoreID, v.SkuID)
|
||||
if actStoreSkuMap[index] == nil || actStoreSkuMap[index].ActualActPrice > v.ActualActPrice {
|
||||
actStoreSkuMap[index] = v
|
||||
}
|
||||
}
|
||||
|
||||
for _, skuName := range skuNamesInfo.SkuNames {
|
||||
if len(skuName.Skus2) > 0 {
|
||||
for _, v := range skuName.Skus2 {
|
||||
index := dao.GenSkuPriceMapKey(skuName.StoreID, v.SkuID)
|
||||
if actStoreSkuMap[index] != nil {
|
||||
v.ActPrice = int(actStoreSkuMap[index].ActualActPrice)
|
||||
}
|
||||
if jxSkuPriceMap[index] != nil {
|
||||
v.EarningPrice = jxSkuPriceMap[index].EarningPrice
|
||||
}
|
||||
|
||||
v.RealEarningPrice = v.EarningPrice
|
||||
if v.RealEarningPrice == 0 {
|
||||
v.RealEarningPrice = int(jxutils.CaculateSkuEarningPrice(int64(v.BindPrice), int64(v.BindPrice), skuName.PayPercentage))
|
||||
}
|
||||
}
|
||||
} else {
|
||||
skuName.UnitPrice = skuName.Price
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func updateSaleInfo4StoreSkuName(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs, skuIDs []int, params map[string]interface{}, skuNamesInfo *StoreSkuNamesInfo, offset, pageSize int) (err error) {
|
||||
var (
|
||||
saleInfoList []*SkuSaleInfo
|
||||
|
||||
Reference in New Issue
Block a user