ActStoreSkuParam2Model重叠判断逻辑
This commit is contained in:
@@ -151,6 +151,8 @@ func ActStoreSkuParam2Model(ctx *jxcontext.Context, db *dao.DaoDB, act *model.Ac
|
|||||||
storeIDMap := make(map[int]int)
|
storeIDMap := make(map[int]int)
|
||||||
skuIDMap := make(map[int]int)
|
skuIDMap := make(map[int]int)
|
||||||
storeSkuParamMap := make(map[int][]*ActStoreSkuParam)
|
storeSkuParamMap := make(map[int][]*ActStoreSkuParam)
|
||||||
|
|
||||||
|
actStoreSkuMap := make(map[int64]bool)
|
||||||
var wrongSkuList []*ActStoreSkuParam
|
var wrongSkuList []*ActStoreSkuParam
|
||||||
for _, v := range actStoreSku {
|
for _, v := range actStoreSku {
|
||||||
if act.Type == model.ActSkuFake && v.EarningPrice == 0 {
|
if act.Type == model.ActSkuFake && v.EarningPrice == 0 {
|
||||||
@@ -159,6 +161,8 @@ func ActStoreSkuParam2Model(ctx *jxcontext.Context, db *dao.DaoDB, act *model.Ac
|
|||||||
storeIDMap[v.StoreID] = 1
|
storeIDMap[v.StoreID] = 1
|
||||||
skuIDMap[v.SkuID] = 1
|
skuIDMap[v.SkuID] = 1
|
||||||
storeSkuParamMap[v.StoreID] = append(storeSkuParamMap[v.StoreID], v)
|
storeSkuParamMap[v.StoreID] = append(storeSkuParamMap[v.StoreID], v)
|
||||||
|
|
||||||
|
actStoreSkuMap[jxutils.Combine2Int(v.StoreID, v.SkuID)] = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(wrongSkuList) > 0 {
|
if len(wrongSkuList) > 0 {
|
||||||
@@ -166,7 +170,7 @@ func ActStoreSkuParam2Model(ctx *jxcontext.Context, db *dao.DaoDB, act *model.Ac
|
|||||||
}
|
}
|
||||||
storeIDs := jxutils.IntMap2List(storeIDMap)
|
storeIDs := jxutils.IntMap2List(storeIDMap)
|
||||||
skuIDs := jxutils.IntMap2List(skuIDMap)
|
skuIDs := jxutils.IntMap2List(skuIDMap)
|
||||||
// 判断活动是否重叠的检查,当前忽略京东平台及所有结算信息
|
|
||||||
if act.OverlapRule == model.OverlapRuleNormal {
|
if act.OverlapRule == model.OverlapRuleNormal {
|
||||||
effectActStoreSkuList, err := dao.GetEffectiveActStoreSkuInfo(db, 0, vendorIDs, act.Type, storeIDs, skuIDs, act.BeginAt, act.EndAt)
|
effectActStoreSkuList, err := dao.GetEffectiveActStoreSkuInfo(db, 0, vendorIDs, act.Type, storeIDs, skuIDs, act.BeginAt, act.EndAt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -174,7 +178,15 @@ func ActStoreSkuParam2Model(ctx *jxcontext.Context, db *dao.DaoDB, act *model.Ac
|
|||||||
return nil, nil, nil, err
|
return nil, nil, nil, err
|
||||||
}
|
}
|
||||||
if len(effectActStoreSkuList) > 0 {
|
if len(effectActStoreSkuList) > 0 {
|
||||||
return nil, nil, nil, jsonerr.New(effectActStoreSkuList, model.ErrCodeJsonActSkuConflict)
|
var realEffectActStoreSkuList []*model.ActStoreSku2
|
||||||
|
for _, v := range effectActStoreSkuList {
|
||||||
|
if actStoreSkuMap[jxutils.Combine2Int(v.StoreID, v.SkuID)] {
|
||||||
|
realEffectActStoreSkuList = append(realEffectActStoreSkuList, v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(realEffectActStoreSkuList) > 0 {
|
||||||
|
return nil, nil, nil, jsonerr.New(realEffectActStoreSkuList, model.ErrCodeJsonActSkuConflict)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user