From 7f25da11a13a6043f28f0ddbb5ded05c7b6cee49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 28 Jan 2021 17:28:01 +0800 Subject: [PATCH] aa --- business/jxstore/cms/sync2.go | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/business/jxstore/cms/sync2.go b/business/jxstore/cms/sync2.go index b125d2bb7..bdbf335f9 100644 --- a/business/jxstore/cms/sync2.go +++ b/business/jxstore/cms/sync2.go @@ -556,6 +556,21 @@ func amendAndPruneVendorStuff(ctx *jxcontext.Context, parentTask tasksch.ITask, localCatMap[utils.Int2Str(v.ID)] = v } + vendorCatMap := make(map[int]*model.VendorCategoryMap) + if vendorOrgCodes[0].IsJxCat == model.YES { + vendorCats, _ := dao.GetVendorCategoryMap(db, -1, 0, vendorID, vendorOrgCode, 0) + for _, v := range vendorCats { + if _, ok := vendorCatMap[v.CategoryID]; !ok { + vendorCatMap[v.CategoryID] = v + } + } + } + getSyncFlagCat := func(categoryID int) int8 { + if vendorCatMap[categoryID] != nil { + return model.SyncFlagNewMask + } + return 0 + } remoteCatList, err2 := handler.GetAllCategories(ctx, vendorOrgCode) if err = err2; err == nil { remoteCatMap := make(map[string]int) @@ -567,14 +582,14 @@ func amendAndPruneVendorStuff(ctx *jxcontext.Context, parentTask tasksch.ITask, if !model.IsSyncStatusDelete(v.CatSyncStatus) { if remoteCatMap[v.VendorCatID] == 0 { if !model.IsSyncStatusNew(v.CatSyncStatus) { - OnCreateThing(ctx, db, vendorOrgCodes, int64(v.ID), model.ThingTypeCategory, model.SyncFlagNewMask, false) + OnCreateThing(ctx, db, vendorOrgCodes, int64(v.ID), model.ThingTypeCategory, getSyncFlagCat(v.ID), true) } } else if isForceUpdate && !model.IsSyncStatusUpdate(v.CatSyncStatus) { OnUpdateThing(ctx, db, vendorOrgCodes, int64(v.ID), model.ThingTypeCategory) } } } else { - OnCreateThing(ctx, db, vendorOrgCodes, int64(v.ID), model.ThingTypeCategory, model.SyncFlagNewMask, false) + OnCreateThing(ctx, db, vendorOrgCodes, int64(v.ID), model.ThingTypeCategory, getSyncFlagCat(v.ID), true) } } }