From ccc0d3dfdab93fc35547face7f617e9b06f96d1a Mon Sep 17 00:00:00 2001 From: gazebo Date: Thu, 12 Dec 2019 10:02:37 +0800 Subject: [PATCH] updateThingMapEntity --- business/jxstore/cms/sync2.go | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/business/jxstore/cms/sync2.go b/business/jxstore/cms/sync2.go index 0dcbcf384..32d91c970 100644 --- a/business/jxstore/cms/sync2.go +++ b/business/jxstore/cms/sync2.go @@ -316,20 +316,22 @@ func OnThingSync(ctx *jxcontext.Context, db *dao.DaoDB, thingMap *model.ThingMap } func updateThingMapEntity(db *dao.DaoDB, thingMap *model.ThingMap) { - if thingMap.ThingType == model.ThingTypeCategory { - cat := &model.SkuCategory{ - JdID: utils.Str2Int64WithDefault(thingMap.VendorThingID, 0), - JdSyncStatus: thingMap.SyncStatus, + if thingMap.VendorOrgCode == globals.JdOrgCode { + if thingMap.ThingType == model.ThingTypeCategory { + cat := &model.SkuCategory{ + JdID: utils.Str2Int64WithDefault(thingMap.VendorThingID, 0), + JdSyncStatus: thingMap.SyncStatus, + } + cat.ID = int(thingMap.ThingID) + dao.UpdateEntity(db, cat, "JdID", "JdSyncStatus") + } else if thingMap.ThingType == model.ThingTypeSku { + sku := &model.Sku{ + JdID: utils.Str2Int64WithDefault(thingMap.VendorThingID, 0), + JdSyncStatus: thingMap.SyncStatus, + } + sku.ID = int(thingMap.ThingID) + dao.UpdateEntity(db, sku, "JdID", "JdSyncStatus") } - cat.ID = int(thingMap.ThingID) - dao.UpdateEntity(db, cat, "JdID", "JdSyncStatus") - } else if thingMap.ThingType == model.ThingTypeSku { - sku := &model.Sku{ - JdID: utils.Str2Int64WithDefault(thingMap.VendorThingID, 0), - JdSyncStatus: thingMap.SyncStatus, - } - sku.ID = int(thingMap.ThingID) - dao.UpdateEntity(db, sku, "JdID", "JdSyncStatus") } }