1
This commit is contained in:
@@ -6584,7 +6584,16 @@ func CopyMtToJd(ctx *jxcontext.Context, mtStoreID, mtOrgCode, jdStoreID, jdOrgCo
|
||||
step := batchItemList[0].(int)
|
||||
switch step {
|
||||
case 0:
|
||||
globals.SugarLogger.Debugf("-----------------11111")
|
||||
jdCatList, _ := jd.QueryCategoriesByOrgCode()
|
||||
catList, _ := mtapi.RetailCatList(mtStoreID)
|
||||
for _, jdc := range jdCatList {
|
||||
for _, mtc := range catList {
|
||||
if jdc.Name == mtc.Name {
|
||||
catMap[mtc.Code] = utils.Int64ToStr(jdc.Id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//建分类 ,账号存在分类,不在创建分类
|
||||
//jdCatList, _ := jd.QueryCategoriesByOrgCode()
|
||||
//if len(jdCatList) == 0 {
|
||||
@@ -6594,7 +6603,7 @@ func CopyMtToJd(ctx *jxcontext.Context, mtStoreID, mtOrgCode, jdStoreID, jdOrgCo
|
||||
// if 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-- {
|
||||
// catID2, _ := jd.AddShopCategory(utils.Str2Int64(catID), catList[i].Children[j].Name, catList[i].Children[j].Level, catList[i].Children[j].Sequence, "")
|
||||
@@ -6643,20 +6652,23 @@ func CopyMtToJd(ctx *jxcontext.Context, mtStoreID, mtOrgCode, jdStoreID, jdOrgCo
|
||||
vendorCategoryId, _ := handler.GetSkuCategoryIdByName(jdOrgCode, mtSku.Name)
|
||||
if vendorCategoryId != "" {
|
||||
param.CategoryID = utils.Str2Int64(vendorCategoryId) // 其他水果
|
||||
} else {
|
||||
} else if utils.Str2Int64(vendorCategoryId) > 25048 { // 只有水果,後面刪除
|
||||
param.CategoryID = 22410 // 其他水果
|
||||
}
|
||||
param.ShopCategories = append(param.ShopCategories, 33313305) // 暂无分类
|
||||
if mtSku.SecondaryCategoryCode != "" {
|
||||
param.ShopCategories = append(param.ShopCategories, utils.Str2Int64(catMap[mtSku.SecondaryCategoryCode]))
|
||||
} else if mtSku.CategoryCode != "" {
|
||||
param.ShopCategories = append(param.ShopCategories, utils.Str2Int64(catMap[mtSku.CategoryCode]))
|
||||
} else {
|
||||
param.ShopCategories = append(param.ShopCategories, 33313305) // 暂无分类
|
||||
}
|
||||
if mtSku.PictureContents != "" {
|
||||
param.ProductDesc = fmt.Sprintf(`<img src="%s" alt="一张图片" />`, mtSku.PictureContents)
|
||||
}
|
||||
param.ProductDesc = fmt.Sprintf(`<img src="%s" alt="一张图片" />`, mtSku.PictureContents)
|
||||
globals.SugarLogger.Debugf("-------------skuname := %s", param.SkuName)
|
||||
skuID, err := jd.AddSku2(param)
|
||||
if err != nil {
|
||||
globals.SugarLogger.Debugf("---------AddSku2 := %s,%v", skuID, err)
|
||||
globals.SugarLogger.Debugf("-------------skuname := %s", param.SkuName)
|
||||
globals.SugarLogger.Debugf("---------AddSku2 := %s,%s,%v", param.SkuName, skuID, err)
|
||||
}
|
||||
if skuID != "" {
|
||||
jd.UpdateCurrentQty(ctx.GetTrackInfo(), jdStoreID, utils.Str2Int64(skuID), utils.Str2Int(mtSku.SkuList[0].Stock))
|
||||
|
||||
Reference in New Issue
Block a user