结算活动不要求门店关注商品
不自动过滤没有关注的商品,会报错
This commit is contained in:
@@ -120,10 +120,9 @@ func ActStoreSkuParam2Model(ctx *jxcontext.Context, db *dao.DaoDB, act *model.Ac
|
||||
storeDetail, err2 := dao.GetStoreDetail(db, storeID, vendorID)
|
||||
if err = err2; err == nil {
|
||||
for _, v := range oneStoreSkuParam {
|
||||
if storeSkuInfo := storeSkuMap[jxutils.Combine2Int(v.StoreID, v.SkuID)]; storeSkuInfo != nil {
|
||||
validVendorMap[vendorID] = 1
|
||||
validSkuMap[v.SkuID] = 1
|
||||
pricePercentage := jxutils.GetPricePercentage(storeDetail.PricePercentagePackObj, storeSkuInfo.Price, int(storeDetail.PricePercentage))
|
||||
v.ActID = act.ID
|
||||
actSkuMap := &model.ActStoreSkuMap{
|
||||
ActID: act.ID,
|
||||
StoreID: storeID,
|
||||
@@ -131,9 +130,18 @@ func ActStoreSkuParam2Model(ctx *jxcontext.Context, db *dao.DaoDB, act *model.Ac
|
||||
VendorID: vendorID,
|
||||
|
||||
SyncStatus: model.SyncFlagNewMask,
|
||||
VendorPrice: int64(jxutils.CaculateSkuVendorPrice(storeSkuInfo.Price, pricePercentage)),
|
||||
}
|
||||
v.OriginalPrice = actSkuMap.VendorPrice
|
||||
if storeSkuInfo := storeSkuMap[jxutils.Combine2Int(v.StoreID, v.SkuID)]; storeSkuInfo != nil {
|
||||
jxPrice := storeSkuInfo.Price
|
||||
pricePercentage := jxutils.GetPricePercentage(storeDetail.PricePercentagePackObj, jxPrice, int(storeDetail.PricePercentage))
|
||||
actSkuMap.VendorPrice = int64(jxutils.CaculateSkuVendorPrice(jxPrice, pricePercentage))
|
||||
v.OriginalPrice = int64(jxPrice)
|
||||
} else if act.Type != model.ActSkuFake {
|
||||
v.ErrMsg = fmt.Sprintf("门店:%d没有关注商品:%d", v.StoreID, v.SkuID)
|
||||
wrongSkuList = append(wrongSkuList, v)
|
||||
continue
|
||||
}
|
||||
if act.Type == model.ActSkuFake {
|
||||
actSkuMap.ActualActPrice = 0
|
||||
} else {
|
||||
@@ -161,9 +169,6 @@ func ActStoreSkuParam2Model(ctx *jxcontext.Context, db *dao.DaoDB, act *model.Ac
|
||||
dao.WrapAddIDCULDEntity(actSkuMap, ctx.GetUserName())
|
||||
actStoreSkuMapList = append(actStoreSkuMapList, actSkuMap)
|
||||
}
|
||||
} else {
|
||||
globals.SugarLogger.Debugf("ActStoreSkuParam2Model storeID:%d, skuID:%d没有关注", v.StoreID, v.SkuID)
|
||||
}
|
||||
}
|
||||
wholeValidVendorMap[vendorID] = 1
|
||||
} else if !dao.IsNoRowsError(err) {
|
||||
@@ -175,17 +180,13 @@ func ActStoreSkuParam2Model(ctx *jxcontext.Context, db *dao.DaoDB, act *model.Ac
|
||||
if len(wrongSkuList) == 0 {
|
||||
for _, v := range oneStoreSkuParam {
|
||||
if validSkuMap[v.SkuID] == 1 { // todo 这里是否需要判断
|
||||
if storeSkuInfo := storeSkuMap[jxutils.Combine2Int(v.StoreID, v.SkuID)]; storeSkuInfo != nil {
|
||||
storeSku := &v.ActStoreSku
|
||||
storeSku.ActID = act.ID
|
||||
storeSku.OriginalPrice = int64(storeSkuInfo.Price)
|
||||
dao.WrapAddIDCULDEntity(storeSku, ctx.GetUserName())
|
||||
actStoreSkuList = append(actStoreSkuList, storeSku)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(wrongSkuList) > 0 {
|
||||
return nil, nil, nil, jsonerr.New(wrongSkuList, model.ErrCodeJsonActPriceTooLarger)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user