1
This commit is contained in:
@@ -6584,24 +6584,24 @@ func CopyMtToJd(ctx *jxcontext.Context, mtStoreID, mtOrgCode, jdStoreID, jdOrgCo
|
||||
switch step {
|
||||
case 0:
|
||||
//建分类 ,账号存在分类,不在创建分类
|
||||
jdCatList, _ := jd.QueryCategoriesByOrgCode()
|
||||
if len(jdCatList) == 0 {
|
||||
catList, _ := mtapi.RetailCatList(mtStoreID)
|
||||
for i := len(catList) - 1; i > -1; i-- {
|
||||
catID, _ := jd.AddShopCategory(0, catList[i].Name, catList[i].Level, catList[i].Sequence, "")
|
||||
if catID != "" {
|
||||
catMap[catList[i].Code] = catID
|
||||
}
|
||||
//LoopCatChild(catList[i].Code, catID, catList[i].Children)
|
||||
//美团好像只能建两级分类?
|
||||
for j := len(catList[i].Children) - 1; j > -1; j-- {
|
||||
catID2, _ := jd.AddShopCategory(utils.Str2Int64(catID), catList[i].Children[j].Name, catList[i].Children[j].Level, catList[i].Children[j].Sequence, "")
|
||||
if catID2 != "" {
|
||||
catMap[catList[i].Children[j].Code] = catID2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//jdCatList, _ := jd.QueryCategoriesByOrgCode()
|
||||
//if len(jdCatList) == 0 {
|
||||
// catList, _ := mtapi.RetailCatList(mtStoreID)
|
||||
// for i := len(catList) - 1; i > -1; i-- {
|
||||
// catID, _ := jd.AddShopCategory(0, catList[i].Name, catList[i].Level, catList[i].Sequence, "")
|
||||
// if catID != "" {
|
||||
// catMap[catList[i].Code] = catID
|
||||
// }
|
||||
// //LoopCatChild(catList[i].Code, catID, catList[i].Children)
|
||||
// //美团好像只能建两级分类?
|
||||
// for j := len(catList[i].Children) - 1; j > -1; j-- {
|
||||
// catID2, _ := jd.AddShopCategory(utils.Str2Int64(catID), catList[i].Children[j].Name, catList[i].Children[j].Level, catList[i].Children[j].Sequence, "")
|
||||
// if catID2 != "" {
|
||||
// catMap[catList[i].Children[j].Code] = catID2
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
case 1:
|
||||
//建商品
|
||||
skuList := make([]*mtwmapi.AppFood, 0, 0)
|
||||
@@ -6612,6 +6612,7 @@ func CopyMtToJd(ctx *jxcontext.Context, mtStoreID, mtOrgCode, jdStoreID, jdOrgCo
|
||||
break
|
||||
}
|
||||
}
|
||||
globals.SugarLogger.Debugf("-----------lens := %d", len(skuList))
|
||||
//skuList, _ := mtapi.RetailList(mtStoreID, 0, 2)
|
||||
task2 := tasksch.NewParallelTask("美团到京东, 建商品", tasksch.NewParallelConfig().SetIsContinueWhenError(true).SetParallelCount(1), ctx,
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
@@ -6648,6 +6649,9 @@ func CopyMtToJd(ctx *jxcontext.Context, mtStoreID, mtOrgCode, jdStoreID, jdOrgCo
|
||||
}
|
||||
param.ProductDesc = fmt.Sprintf(`<img src="%s" alt="一张图片" />`, mtSku.PictureContents)
|
||||
skuID, err := jd.AddSku2(param)
|
||||
if err != nil {
|
||||
globals.SugarLogger.Debugf("---------AddSku2 := %s,%v", skuID, err)
|
||||
}
|
||||
if skuID != "" {
|
||||
jd.UpdateCurrentQty(ctx.GetTrackInfo(), jdStoreID, utils.Str2Int64(skuID), utils.Str2Int(mtSku.SkuList[0].Stock))
|
||||
jd.UpdateVendibility(ctx.GetTrackInfo(), []*jdapi.QueryStockRequest{
|
||||
|
||||
Reference in New Issue
Block a user