- up
This commit is contained in:
@@ -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