From 51b49e17f89061b590ac6885294ad3e0b3191f00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 22 Sep 2023 09:20:34 +0800 Subject: [PATCH] 1 --- business/jxstore/cms/system_store_sku.go | 25 ++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/business/jxstore/cms/system_store_sku.go b/business/jxstore/cms/system_store_sku.go index d1d8ad8e3..0cc94afaf 100644 --- a/business/jxstore/cms/system_store_sku.go +++ b/business/jxstore/cms/system_store_sku.go @@ -22,17 +22,18 @@ func CopyOnStoreSkuToOther(ctx *jxcontext.Context, fromVendorStoreId, toStoreId ) // 门店api加载 - // fromStore, err := dao.GetStoreDetail(db, fromStoreId, model.VendorIDMTWM, "") + toStore, err := dao.GetStoreDetailByVendorStoreID(db, utils.Int2Str(toStoreId), model.VendorIDMTWM, "") if err != nil { return "", err } - toStore, err := dao.GetStoreDetail(db, toStoreId, model.VendorIDMTWM, "") - if err != nil { - return "", err - } - //fromApi := partner.CurAPIManager.GetAPI(model.VendorIDMTWM, toStore.VendorOrgCode).(*mtwmapi.API) toApi := partner.CurAPIManager.GetAPI(model.VendorIDMTWM, toStore.VendorOrgCode).(*mtwmapi.API) + fromStore, err := dao.GetStoreDetailByVendorStoreID(db, utils.Int2Str(fromVendorStoreId), model.VendorIDMTWM, "") + if err != nil { + return "", err + } + fromApi := partner.CurAPIManager.GetAPI(model.VendorIDMTWM, fromStore.VendorOrgCode).(*mtwmapi.API) + taskName := fmt.Sprintf("将平台门店[%d],分类和商品复制到[%d]", fromVendorStoreId, toStoreId) config := tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(false) work := func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { @@ -40,13 +41,13 @@ func CopyOnStoreSkuToOther(ctx *jxcontext.Context, fromVendorStoreId, toStoreId switch step { case 1: // 1.加载门店商品,删除商品.当分类下没有商品时.删除分类 - errs := LoadingStoreSkuList(ctx, toApi, toStore.VendorStoreID) - if errs != nil && len(errs) > 0 { - return nil, errs[0] - } + //errs := LoadingStoreSkuList(ctx, toApi, toStore.VendorStoreID) + //if errs != nil && len(errs) > 0 { + // return nil, errs[0] + //} case 2: // 同步分类 - fromCategoryList, err := toApi.RetailCatList(utils.Int2Str(fromVendorStoreId)) + fromCategoryList, err := fromApi.RetailCatList(utils.Int2Str(fromVendorStoreId)) if err != nil { return nil, err } @@ -73,7 +74,7 @@ func CopyOnStoreSkuToOther(ctx *jxcontext.Context, fromVendorStoreId, toStoreId case 3: // 同步商品 - fromFoodList, err1 := toApi.RetailListAll(utils.Int2Str(fromVendorStoreId)) + fromFoodList, err1 := fromApi.RetailListAll(utils.Int2Str(fromVendorStoreId)) if err1 != nil { return nil, err1 }