1
This commit is contained in:
@@ -208,35 +208,35 @@ func CopyMtToMT(ctx *jxcontext.Context, fromStore, toStore *dao.StoreDetail, isA
|
|||||||
switch step {
|
switch step {
|
||||||
case 1:
|
case 1:
|
||||||
// 同步分类
|
// 同步分类
|
||||||
//fromCategoryList, err := fromApi.RetailCatList(fromStore.VendorStoreID)
|
fromCategoryList, err := fromApi.RetailCatList(fromStore.VendorStoreID)
|
||||||
//if len(fromCategoryList) == model.NO {
|
if len(fromCategoryList) == model.NO {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
//toCategoryList, err := toApi.RetailCatList(toStore.VendorStoreID)
|
||||||
|
//if err != nil {
|
||||||
// return nil, err
|
// return nil, err
|
||||||
//}
|
//}
|
||||||
////toCategoryList, err := toApi.RetailCatList(toStore.VendorStoreID)
|
for _, v := range fromCategoryList {
|
||||||
////if err != nil {
|
categoryErr := toApi.RetailCatUpdate(toStore.VendorStoreID, v.Name, &mtwmapi.Param4UpdateCat{
|
||||||
//// return nil, err
|
CategoryCode: v.Code,
|
||||||
////}
|
Sequence: v.Sequence,
|
||||||
//for _, v := range fromCategoryList {
|
})
|
||||||
// categoryErr := toApi.RetailCatUpdate(toStore.VendorStoreID, v.Name, &mtwmapi.Param4UpdateCat{
|
if categoryErr != nil {
|
||||||
// CategoryCode: v.Code,
|
globals.SugarLogger.Debugf("err := RetailCatUpdate : %v", categoryErr)
|
||||||
// Sequence: v.Sequence,
|
}
|
||||||
// })
|
if v.Children != nil && len(v.Children) != 0 {
|
||||||
// if categoryErr != nil {
|
for _, c := range v.Children {
|
||||||
// globals.SugarLogger.Debugf("err := RetailCatUpdate : %v", categoryErr)
|
if err3 := toApi.RetailCatUpdate(toStore.VendorStoreID, v.Name, &mtwmapi.Param4UpdateCat{
|
||||||
// }
|
CategoryNameOrigin: v.Name,
|
||||||
// if v.Children != nil && len(v.Children) != 0 {
|
SecondaryCategoryCode: c.Code,
|
||||||
// for _, c := range v.Children {
|
SecondaryCategoryName: c.Name,
|
||||||
// if err3 := toApi.RetailCatUpdate(toStore.VendorStoreID, v.Name, &mtwmapi.Param4UpdateCat{
|
Sequence: c.Sequence,
|
||||||
// CategoryNameOrigin: v.Name,
|
}); err3 != nil {
|
||||||
// SecondaryCategoryCode: c.Code,
|
globals.SugarLogger.Debugf("err := RetailCatUpdate Children : %v", err3)
|
||||||
// SecondaryCategoryName: c.Name,
|
}
|
||||||
// Sequence: c.Sequence,
|
}
|
||||||
// }); err3 != nil {
|
}
|
||||||
// globals.SugarLogger.Debugf("err := RetailCatUpdate Children : %v", err3)
|
}
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
i := offSet
|
i := offSet
|
||||||
@@ -363,17 +363,15 @@ func BatchInitSkuMT2MT(ctx *jxcontext.Context, fromSku []*mtwmapi.AppFood, toApi
|
|||||||
|
|
||||||
//todo 增加商品必填属性
|
//todo 增加商品必填属性
|
||||||
//foodData["common_attr_value"] = storeSku.CommonAttrValue
|
//foodData["common_attr_value"] = storeSku.CommonAttrValue
|
||||||
globals.SugarLogger.Debugf("---utils.Interface2Int64WithDefault(foodData[\"category_code\"], 0): %d", utils.Interface2Int64WithDefault(foodData["category_code"], 0))
|
|
||||||
if categoryCode := utils.Interface2Int64WithDefault(foodData["category_code"], 0); categoryCode != 0 {
|
if categoryCode := utils.Interface2Int64WithDefault(foodData["category_code"], 0); categoryCode != 0 {
|
||||||
commonAttrValue, err := createCommonAttrValue(toApi, categoryCode, utils.Interface2String(foodData["name"]))
|
commonAttrValue, err := createCommonAttrValue(toApi, categoryCode, utils.Interface2String(foodData["name"]))
|
||||||
if err == nil {
|
if err == nil {
|
||||||
globals.SugarLogger.Debugf("---commonAttrValue: %s", commonAttrValue)
|
|
||||||
foodData["common_attr_value"] = commonAttrValue
|
foodData["common_attr_value"] = commonAttrValue
|
||||||
globals.SugarLogger.Debugf("------------common_attr_value := %s", commonAttrValue)
|
|
||||||
} else if storeSku.CommonAttrValue != "" && storeSku.CommonAttrValue != "[]" {
|
} else if storeSku.CommonAttrValue != "" && storeSku.CommonAttrValue != "[]" {
|
||||||
globals.SugarLogger.Debugf("---err: %v", err)
|
|
||||||
foodData["common_attr_value"] = mtwmapi.CommonAttrValueUpdate(storeSku.CommonAttrValue)
|
foodData["common_attr_value"] = mtwmapi.CommonAttrValueUpdate(storeSku.CommonAttrValue)
|
||||||
}
|
}
|
||||||
|
} else if storeSku.CommonAttrValue != "" && storeSku.CommonAttrValue != "[]" {
|
||||||
|
foodData["common_attr_value"] = mtwmapi.CommonAttrValueUpdate(storeSku.CommonAttrValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
foodData["is_sold_out"] = storeSku.IsSoldOut
|
foodData["is_sold_out"] = storeSku.IsSoldOut
|
||||||
|
|||||||
Reference in New Issue
Block a user