1
This commit is contained in:
@@ -109,27 +109,76 @@ func CopyEBaiToEBai(ctx *jxcontext.Context, fromStore, toStore *dao.StoreDetail,
|
||||
//}
|
||||
case 2:
|
||||
//同步分类
|
||||
fromCategoryList, err := api.ShopCategoryGet(utils.Int2Str(fromStore.ID))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, v := range fromCategoryList {
|
||||
parentID, categoryErr := api.ShopCategoryCreate(utils.Int2Str(toStore.ID), 0, v.Name, v.Rank)
|
||||
if categoryErr != nil {
|
||||
globals.SugarLogger.Debugf("err := RetailCatUpdate : %v", categoryErr)
|
||||
continue
|
||||
}
|
||||
VendorCategoryIDMap[v.CategoryID] = parentID
|
||||
if v.Children != nil && len(v.Children) != 0 {
|
||||
for _, c := range v.Children {
|
||||
childrenCateId, err := api.ShopCategoryCreate(utils.Int2Str(toStore.ID), parentID, c.Name, c.Rank)
|
||||
if err != nil {
|
||||
globals.SugarLogger.Debugf("err := RetailCatUpdate Children : %v", err)
|
||||
continue
|
||||
}
|
||||
VendorCategoryIDMap[c.CategoryID] = childrenCateId
|
||||
}
|
||||
}
|
||||
//fromCategoryList, err := api.ShopCategoryGet(utils.Int2Str(fromStore.ID))
|
||||
//if err != nil {
|
||||
// return nil, err
|
||||
//}
|
||||
//for _, v := range fromCategoryList {
|
||||
// parentID, categoryErr := api.ShopCategoryCreate(utils.Int2Str(toStore.ID), 0, v.Name, v.Rank)
|
||||
// if categoryErr != nil {
|
||||
// globals.SugarLogger.Debugf("err := RetailCatUpdate : %v", categoryErr)
|
||||
// continue
|
||||
// }
|
||||
// VendorCategoryIDMap[v.CategoryID] = parentID
|
||||
// if v.Children != nil && len(v.Children) != 0 {
|
||||
// for _, c := range v.Children {
|
||||
// childrenCateId, err := api.ShopCategoryCreate(utils.Int2Str(toStore.ID), parentID, c.Name, c.Rank)
|
||||
// if err != nil {
|
||||
// globals.SugarLogger.Debugf("err := RetailCatUpdate Children : %v", err)
|
||||
// continue
|
||||
// }
|
||||
// VendorCategoryIDMap[c.CategoryID] = childrenCateId
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
VendorCategoryIDMap = map[int64]int64{
|
||||
1647792815228: 1783655621221494,
|
||||
166074216522662: 1783655616221476,
|
||||
166074277122800: 1783655619221486,
|
||||
1660817971221141: 1783655621221495,
|
||||
166087125422564: 1783655616221474,
|
||||
168123919522131: 1783655620221490,
|
||||
16831126732292: 1783655621221493,
|
||||
170532859722299: 1783655614221451,
|
||||
17053370692243: 1783655616221472,
|
||||
17110932372230: 1783655614221454,
|
||||
1712655580225326: 1783655619221487,
|
||||
172536777922315: 1783655620221492,
|
||||
17278653502220: 1783655622221498,
|
||||
174809565622151: 1783655615221470,
|
||||
1752773599225: 1783655621221496,
|
||||
1752773622226: 1783655619221485,
|
||||
175300467322516: 1783655616221475,
|
||||
175363909122230: 1783655617221479,
|
||||
1758352353221072: 1783655620221491,
|
||||
1758387942228: 1783655618221484,
|
||||
1763709422226666: 1783655622221497,
|
||||
176563009122143: 1783663337221887,
|
||||
176717046822902: 178358015522541,
|
||||
176717046822903: 1783655628221543,
|
||||
176774799222377: 1783655622221499,
|
||||
1767748733221565: 1783655623221512,
|
||||
176775575122888: 1783655623221509,
|
||||
176783623022984: 178358015622554,
|
||||
176783831622900: 1783655628221544,
|
||||
176783886722192: 178364558822191,
|
||||
177243820422532: 1783655617221480,
|
||||
177243820422533: 1783655618221481,
|
||||
177243820422534: 1783655618221483,
|
||||
17725113282251: 1783655618221482,
|
||||
177322471322207: 1783655620221489,
|
||||
177322471322208: 1783655619221488,
|
||||
177328570522328: 1783655617221477,
|
||||
177328593622153: 1783655617221478,
|
||||
177528018022662: 1783655615221469,
|
||||
17776912892222: 1783655615221468,
|
||||
177830887822245: 1783655623221511,
|
||||
177857557522194: 1783655614221453,
|
||||
17786606752211879: 1783655614221452,
|
||||
1780019613224672: 178364625622332,
|
||||
17815417862237: 1783655615221465,
|
||||
1783567962221199: 1783646592221185,
|
||||
178357784822717: 1783592931221880,
|
||||
}
|
||||
case 3:
|
||||
skuIdOffset := 0
|
||||
@@ -142,16 +191,14 @@ func CopyEBaiToEBai(ctx *jxcontext.Context, fromStore, toStore *dao.StoreDetail,
|
||||
for {
|
||||
// 同步商品
|
||||
fromFoodList, _ := api.SkuList(utils.Int2Str(fromStore.ID), param)
|
||||
if len(fromFoodList.List) < 100 {
|
||||
break
|
||||
}
|
||||
foodListData = append(foodListData, fromFoodList.List...)
|
||||
param.Page += 1
|
||||
skuIdOffset = fromFoodList.SkuIdOffset
|
||||
if len(fromFoodList.List) < 100 {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
globals.SugarLogger.Debugf("--------VendorCategoryIDMap := %s", utils.Format4Output(VendorCategoryIDMap, false))
|
||||
globals.SugarLogger.Debugf("--------foodListData := %d", len(foodListData))
|
||||
errList := BatchInitSkuEBai2EBai(ctx, foodListData, api, utils.Int2Str(toStore.ID), VendorCategoryIDMap)
|
||||
if errList != nil {
|
||||
for _, verr := range errList {
|
||||
@@ -187,7 +234,7 @@ func BatchInitSkuEBai2EBai(ctx *jxcontext.Context, fromSku []*ebaiapi.SkuInfo, t
|
||||
params["upc"] = storeSku.Upc
|
||||
params["name"] = storeSku.Name
|
||||
params["cat3_id"] = storeSku.CateId
|
||||
params["category_id"] = VendorCategoryIDMap[utils.Str2Int64(storeSku.CustomCatList[0].CustomCatID)]
|
||||
params["category_id"] = VendorCategoryIDMap[utils.Str2Int64(storeSku.CustomCatIDs)]
|
||||
params["desc"] = storeSku.Desc
|
||||
params["left_num"] = storeSku.LeftNum
|
||||
params["process_type"] = storeSku.ProcessType
|
||||
|
||||
Reference in New Issue
Block a user