diff --git a/business/jxstore/cms/system_store_sku.go b/business/jxstore/cms/system_store_sku.go index 2f77e451e..8184c8fd9 100644 --- a/business/jxstore/cms/system_store_sku.go +++ b/business/jxstore/cms/system_store_sku.go @@ -46,38 +46,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, err := fromApi.RetailCatList(utils.Int2Str(fromVendorStoreId)) - //globals.SugarLogger.Debugf("fromCategoryList ============ %d", len(fromCategoryList)) - //globals.SugarLogger.Debugf("err ============ %v", err) - //for _, v := range fromCategoryList { - // categoryErr := toApi.RetailCatUpdate(toStore.VendorStoreID, v.Name, &mtwmapi.Param4UpdateCat{ - // CategoryCode: v.Code, - // Sequence: v.Sequence, - // }) - // if categoryErr != nil { - // globals.SugarLogger.Debugf("err := RetailCatUpdate : %v", categoryErr) - // } - // if v.Children != nil && len(v.Children) != 0 { - // for _, c := range v.Children { - // if err3 := 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, - // }); err3 != nil { - // globals.SugarLogger.Debugf("err := RetailCatUpdate Children : %v", err3) - // } - // } - // } - //} + fromCategoryList, err := fromApi.RetailCatList(utils.Int2Str(fromVendorStoreId)) + globals.SugarLogger.Debugf("err ============ %v", err) + for _, v := range fromCategoryList { + categoryErr := toApi.RetailCatUpdate(toStore.VendorStoreID, v.Name, &mtwmapi.Param4UpdateCat{ + CategoryCode: v.Code, + Sequence: v.Sequence, + }) + if categoryErr != nil { + globals.SugarLogger.Debugf("err := RetailCatUpdate : %v", categoryErr) + } + if v.Children != nil && len(v.Children) != 0 { + for _, c := range v.Children { + if err3 := 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, + }); err3 != nil { + globals.SugarLogger.Debugf("err := RetailCatUpdate Children : %v", err3) + } + } + } + } case 3: //i := offSet