This commit is contained in:
邹宗楠
2025-04-28 17:48:40 +08:00
parent d2328de243
commit cb3dadabf6

View File

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