From a236f0b14c821b44b92f7a85ccd2ddb6f3f2be0b 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 14:27:37 +0800 Subject: [PATCH] aa --- business/jxstore/cms/store_sku.go | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index f2cfac981..297d76b20 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -1081,6 +1081,8 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs } userName := ctx.GetUserName() needSyncIDMap := make(map[int]int) + isSyncSkus := false + var appCodeList []string dao.Begin(db) defer func() { if r := recover(); r != nil { @@ -1248,26 +1250,26 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs if thingMaps[0].VendorThingID == "" { //并且同步标志还没有带待创建(因为addskuname现在建到thingmap上不会带待创建标志了) if !model.IsSyncStatusNew(thingMaps[0].SyncStatus) { - if err = OnCreateThing(ctx, db, []*MultiStoreVendorInfo{ + isSyncSkus = true + appCodeList = append(appCodeList, list1[0].VendorOrgCode) + OnCreateThing(ctx, db, []*MultiStoreVendorInfo{ &MultiStoreVendorInfo{ VendorID: model.VendorIDJD, OrgCode: list1[0].VendorOrgCode, }, - }, int64(v.RealSkuID), model.ThingTypeSku, model.SyncFlagNewMask); err == nil { - _, err = SyncSkus(ctx, nil, []int{model.VendorIDJD}, []string{list1[0].VendorOrgCode}, nil, []int{v.RealSkuID}, true) - } + }, int64(v.RealSkuID), model.ThingTypeSku, model.SyncFlagNewMask) } } } else { //万一不存在 - if err = OnCreateThing(ctx, db, []*MultiStoreVendorInfo{ + isSyncSkus = true + appCodeList = append(appCodeList, list1[0].VendorOrgCode) + OnCreateThing(ctx, db, []*MultiStoreVendorInfo{ &MultiStoreVendorInfo{ VendorID: model.VendorIDJD, OrgCode: list1[0].VendorOrgCode, }, - }, int64(v.RealSkuID), model.ThingTypeSku, model.SyncFlagNewMask); err == nil { - _, err = SyncSkus(ctx, nil, []int{model.VendorIDJD}, []string{list1[0].VendorOrgCode}, nil, []int{v.RealSkuID}, true) - } + }, int64(v.RealSkuID), model.ThingTypeSku, model.SyncFlagNewMask) } } } @@ -1418,6 +1420,9 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs } dao.Commit(db) skuIDs := jxutils.IntMap2List(needSyncIDMap) + if isSyncSkus { + _, err = SyncSkus(ctx, nil, []int{model.VendorIDJD}, appCodeList, nil, skuIDs, true) + } return skuIDs, err }