- 优化AddCreateFlagForJxStoreSku

This commit is contained in:
gazebo
2019-08-29 13:59:41 +08:00
parent ce53d17461
commit ce5fc2ef9d
2 changed files with 15 additions and 12 deletions

View File

@@ -539,6 +539,7 @@ func PruneMissingStoreSkus(ctx *jxcontext.Context, parentTask tasksch.ITask, ven
}
}
}
localSkuMap = nil
case 1:
if len(sku2Delete) > 0 {
_, err = putils.FreeBatchStoreSkuInfo("删除门店商品", func(task tasksch.ITask, batchedStoreSkuList []*partner.StoreSkuInfo) (result interface{}, successCount int, err error) {
@@ -570,7 +571,7 @@ func AddCreateFlagForJxStoreSku(ctx *jxcontext.Context, parentTask tasksch.ITask
return "", err
}
var skuIDList []int
var storeSkuBindIDs []int
seqTaskFunc := func(task *tasksch.SeqTask, step int, params ...interface{}) (result interface{}, err error) {
switch step {
case 0:
@@ -583,19 +584,19 @@ func AddCreateFlagForJxStoreSku(ctx *jxcontext.Context, parentTask tasksch.ITask
}
}
for _, v := range localSkuList {
if remoteSkuMap[v.SkuID] == nil && !model.IsSyncStatusNew(v.StoreSkuSyncStatus) && !model.IsSyncStatusDelete(v.StoreSkuSyncStatus) {
skuIDList = append(skuIDList, v.SkuID)
if remoteSkuMap[v.SkuID] == nil && !model.IsSyncStatusNew(v.StoreSkuSyncStatus) && !model.IsSyncStatusDelete(v.StoreSkuSyncStatus) && v.BindID != 0 {
storeSkuBindIDs = append(storeSkuBindIDs, v.BindID)
}
}
storeSkuBindIDs = nil
}
case 1:
if len(skuIDList) > 0 {
storeSkuList, err := dao.GetStoresSkusInfo(db, []int{storeID}, skuIDList)
if err == nil {
for _, skuBind := range storeSkuList {
fieldStatus := dao.GetSyncStatusStructField(model.VendorNames[vendorID])
dao.UpdateEntityLogicallyAndUpdateSyncStatus(db, skuBind, nil, ctx.GetUserName(), nil, fieldStatus, model.SyncFlagNewMask)
}
if len(storeSkuBindIDs) > 0 {
for _, bindID := range storeSkuBindIDs {
fieldStatus := dao.GetSyncStatusStructField(model.VendorNames[vendorID])
skuBind := &model.StoreSkuBind{}
skuBind.ID = bindID
dao.UpdateEntityLogicallyAndUpdateSyncStatus(db, skuBind, nil, ctx.GetUserName(), nil, fieldStatus, model.SyncFlagNewMask)
}
}
}