From abcc7f52cf56b24e75a827543a738ee97cf8ff1c 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 17:40:08 +0800 Subject: [PATCH] 1 --- business/jxstore/cms/system_store_sku.go | 58 ++++++++++++------------ 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/business/jxstore/cms/system_store_sku.go b/business/jxstore/cms/system_store_sku.go index 1be8e2342..2eefebb3e 100644 --- a/business/jxstore/cms/system_store_sku.go +++ b/business/jxstore/cms/system_store_sku.go @@ -43,37 +43,37 @@ 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, _ := fromApi.RetailCatList(utils.Int2Str(fromVendorStoreId)) - // - //for _, v := range fromCategoryList { - // //err := toApi.RetailCatUpdate(toStore.VendorStoreID, v.Name, &mtwmapi.Param4UpdateCat{ - // // CategoryCode: v.Code, - // // Sequence: v.Sequence, - // //}) - // //if err != nil { - // // globals.SugarLogger.Debugf("err := RetailCatUpdate : %s", utils.Format4Output(err, false)) - // //} - // if v.Children != nil && len(v.Children) != 0 { - // for _, c := range v.Children { - // if err := toApi.RetailCatUpdate(toStore.VendorStoreID, v.Name, &mtwmapi.Param4UpdateCat{ - // CategoryNameOrigin: v.Name, - // //CategoryCodeOrigin: v.Code, - // //CategoryCode: v.Code, - // SecondaryCategoryCode: c.Code, - // SecondaryCategoryName: c.Name, - // Sequence: c.Sequence, - // }); err != nil { - // globals.SugarLogger.Debugf("err := RetailCatUpdate Children : %s", utils.Format4Output(c, false)) - // } - // } - // } - //} + fromCategoryList, _ := fromApi.RetailCatList(utils.Int2Str(fromVendorStoreId)) + + for _, v := range fromCategoryList { + err := toApi.RetailCatUpdate(toStore.VendorStoreID, v.Name, &mtwmapi.Param4UpdateCat{ + CategoryCode: v.Code, + Sequence: v.Sequence, + }) + if err != nil { + globals.SugarLogger.Debugf("err := RetailCatUpdate : %s", utils.Format4Output(err, false)) + } + if v.Children != nil && len(v.Children) != 0 { + for _, c := range v.Children { + if err := toApi.RetailCatUpdate(toStore.VendorStoreID, v.Name, &mtwmapi.Param4UpdateCat{ + CategoryNameOrigin: v.Name, + //CategoryCodeOrigin: v.Code, + //CategoryCode: v.Code, + SecondaryCategoryCode: c.Code, + SecondaryCategoryName: c.Name, + Sequence: c.Sequence, + }); err != nil { + globals.SugarLogger.Debugf("err := RetailCatUpdate Children : %s", utils.Format4Output(c, false)) + } + } + } + } case 3: i := offSet