1
This commit is contained in:
@@ -6604,34 +6604,43 @@ func CopyMtToJd(ctx *jxcontext.Context, mtStoreID, mtOrgCode, jdStoreID, jdOrgCo
|
|||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
//建商品
|
//建商品
|
||||||
skuList, _ := mtapi.RetailListAll(mtStoreID, 0)
|
skuList := make([]*mtwmapi.AppFood, 0, 0)
|
||||||
|
for {
|
||||||
|
skuList2, _ := mtapi.RetailListAll(mtStoreID, 0)
|
||||||
|
skuList = append(skuList, skuList2...)
|
||||||
|
if len(skuList2) < 100 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
//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) {
|
||||||
mtSku := batchItemList[0].(*mtwmapi.AppFood)
|
mtSku := batchItemList[0].(*mtwmapi.AppFood)
|
||||||
catMaps, _ := dao.GetMtJdCategoryMap(db, utils.Int2Str(mtSku.TagID), "")
|
catMaps, _ := dao.GetMtJdCategoryMap(db, utils.Int2Str(mtSku.TagID), "")
|
||||||
if len(catMaps) == 0 {
|
//if len(catMaps) == 0 {
|
||||||
results, _ := dao.GetVendorCategoriesWithMap(db, model.VendorIDMTWM, mtSku.TagID)
|
// results, _ := dao.GetVendorCategoriesWithMap(db, model.VendorIDMTWM, mtSku.TagID)
|
||||||
results2, _ := dao.GetVendorCategoriesWithMap(db, model.VendorIDMTWM, utils.Str2Int(results[0].ParentID))
|
// results2, _ := dao.GetVendorCategoriesWithMap(db, model.VendorIDMTWM, utils.Str2Int(results[0].ParentID))
|
||||||
results3, _ := dao.GetVendorCategoriesWithMap(db, model.VendorIDMTWM, utils.Str2Int(results2[0].ParentID))
|
// results3, _ := dao.GetVendorCategoriesWithMap(db, model.VendorIDMTWM, utils.Str2Int(results2[0].ParentID))
|
||||||
return retVal, fmt.Errorf("该商品美团分类还未映射到京东,商品名:[%v],美团分类:[%v] ->[%v] ->[%v]。", mtSku.Name, results3[0].Name, results2[0].Name, results[0].Name)
|
// //return retVal, fmt.Errorf("该商品美团分类还未映射到京东,商品名:[%v],美团分类:[%v] ->[%v] ->[%v]。", mtSku.Name, results3[0].Name, results2[0].Name, results[0].Name)
|
||||||
}
|
//}
|
||||||
param := &jdapi.OpSkuParam{
|
param := &jdapi.OpSkuParam{
|
||||||
TraceID: ctx.GetTrackInfo(),
|
TraceID: ctx.GetTrackInfo(),
|
||||||
OutSkuID: mtSku.AppFoodCode,
|
OutSkuID: mtSku.AppFoodCode,
|
||||||
ShopCategories: []int64{},
|
ShopCategories: []int64{}, // 商家分类
|
||||||
//CategoryID: utils.Str2Int64(catMaps[0].JdID),
|
CategoryID: utils.Str2Int64(catMaps[0].JdID), // 到家分类
|
||||||
CategoryID: 291, // 暂无分类
|
BrandID: 35247,
|
||||||
BrandID: 35247,
|
SkuName: mtSku.Name,
|
||||||
SkuName: mtSku.Name,
|
SkuPrice: int(jxutils.StandardPrice2Int(mtSku.Price)),
|
||||||
SkuPrice: int(jxutils.StandardPrice2Int(mtSku.Price)),
|
Weight: float64(jxutils.IntWeight2Float(utils.Str2Int(mtSku.SkuList[0].Weight))),
|
||||||
Weight: float64(jxutils.IntWeight2Float(utils.Str2Int(mtSku.SkuList[0].Weight))),
|
FixedStatus: 1,
|
||||||
FixedStatus: 1,
|
IsSale: -1,
|
||||||
IsSale: -1,
|
Upc: mtSku.SkuList[0].Upc,
|
||||||
Upc: mtSku.SkuList[0].Upc,
|
Images: mtSku.PictureList,
|
||||||
Images: mtSku.PictureList,
|
|
||||||
}
|
}
|
||||||
param.ShopCategories = append(param.ShopCategories, 16578930) // 暂无分类
|
if len(catMaps) == 0 {
|
||||||
|
param.CategoryID = 22410 // 其他水果
|
||||||
|
}
|
||||||
|
param.ShopCategories = append(param.ShopCategories, 33313305) // 暂无分类
|
||||||
if mtSku.SecondaryCategoryCode != "" {
|
if mtSku.SecondaryCategoryCode != "" {
|
||||||
param.ShopCategories = append(param.ShopCategories, utils.Str2Int64(catMap[mtSku.SecondaryCategoryCode]))
|
param.ShopCategories = append(param.ShopCategories, utils.Str2Int64(catMap[mtSku.SecondaryCategoryCode]))
|
||||||
} else if mtSku.CategoryCode != "" {
|
} else if mtSku.CategoryCode != "" {
|
||||||
|
|||||||
Reference in New Issue
Block a user