This commit is contained in:
邹宗楠
2023-09-22 09:44:19 +08:00
parent f1ff73114f
commit 5d27685e29

View File

@@ -2,6 +2,7 @@ package cms
import (
"fmt"
"git.rosy.net.cn/jx-callback/globals"
"time"
"git.rosy.net.cn/baseapi/platformapi/mtwmapi"
@@ -49,16 +50,15 @@ func CopyOnStoreSkuToOther(ctx *jxcontext.Context, fromVendorStoreId, toStoreId
//}
case 2:
// 同步分类
fromCategoryList, err := fromApi.RetailCatList(utils.Int2Str(fromVendorStoreId))
if err != nil {
return nil, err
}
fromCategoryList, _ := fromApi.RetailCatList(utils.Int2Str(fromVendorStoreId))
for _, v := range fromCategoryList {
if err := toApi.RetailCatUpdate(toStore.VendorStoreID, v.Name, &mtwmapi.Param4UpdateCat{
err := toApi.RetailCatUpdate(toStore.VendorStoreID, v.Name, &mtwmapi.Param4UpdateCat{
CategoryCode: v.Code,
Sequence: v.Sequence,
}); err != nil {
return nil, err
})
if err != nil {
globals.SugarLogger.Debug("err := RetailCatUpdate : %s", utils.Format4Output(err, false))
}
if v.Children != nil && len(v.Children) != 0 {
for _, c := range v.Children {
@@ -68,7 +68,7 @@ func CopyOnStoreSkuToOther(ctx *jxcontext.Context, fromVendorStoreId, toStoreId
SecondaryCategoryName: c.Name,
Sequence: c.Sequence,
}); err != nil {
return nil, err
globals.SugarLogger.Debug("err := RetailCatUpdate Children : %s", utils.Format4Output(err, false))
}
}
}
@@ -78,10 +78,10 @@ func CopyOnStoreSkuToOther(ctx *jxcontext.Context, fromVendorStoreId, toStoreId
// 同步商品
fromFoodList, err1 := fromApi.RetailListAll(utils.Int2Str(fromVendorStoreId))
if err1 != nil {
return nil, err1
globals.SugarLogger.Debug("RetailListAll : %s", utils.Format4Output(err, false))
}
if err := BatchInitData(ctx, fromFoodList, toApi, toStore.VendorStoreID); err != nil {
return nil, err
globals.SugarLogger.Debug("BatchInitData : %s", utils.Format4Output(err, false))
}
}
return