1
This commit is contained in:
@@ -6604,34 +6604,43 @@ func CopyMtToJd(ctx *jxcontext.Context, mtStoreID, mtOrgCode, jdStoreID, jdOrgCo
|
||||
}
|
||||
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)
|
||||
task2 := tasksch.NewParallelTask("美团到京东, 建商品", tasksch.NewParallelConfig().SetIsContinueWhenError(true).SetParallelCount(1), ctx,
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
mtSku := batchItemList[0].(*mtwmapi.AppFood)
|
||||
catMaps, _ := dao.GetMtJdCategoryMap(db, utils.Int2Str(mtSku.TagID), "")
|
||||
if len(catMaps) == 0 {
|
||||
results, _ := dao.GetVendorCategoriesWithMap(db, model.VendorIDMTWM, mtSku.TagID)
|
||||
results2, _ := dao.GetVendorCategoriesWithMap(db, model.VendorIDMTWM, utils.Str2Int(results[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)
|
||||
}
|
||||
//if len(catMaps) == 0 {
|
||||
// results, _ := dao.GetVendorCategoriesWithMap(db, model.VendorIDMTWM, mtSku.TagID)
|
||||
// results2, _ := dao.GetVendorCategoriesWithMap(db, model.VendorIDMTWM, utils.Str2Int(results[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)
|
||||
//}
|
||||
param := &jdapi.OpSkuParam{
|
||||
TraceID: ctx.GetTrackInfo(),
|
||||
OutSkuID: mtSku.AppFoodCode,
|
||||
ShopCategories: []int64{},
|
||||
//CategoryID: utils.Str2Int64(catMaps[0].JdID),
|
||||
CategoryID: 291, // 暂无分类
|
||||
BrandID: 35247,
|
||||
SkuName: mtSku.Name,
|
||||
SkuPrice: int(jxutils.StandardPrice2Int(mtSku.Price)),
|
||||
Weight: float64(jxutils.IntWeight2Float(utils.Str2Int(mtSku.SkuList[0].Weight))),
|
||||
FixedStatus: 1,
|
||||
IsSale: -1,
|
||||
Upc: mtSku.SkuList[0].Upc,
|
||||
Images: mtSku.PictureList,
|
||||
ShopCategories: []int64{}, // 商家分类
|
||||
CategoryID: utils.Str2Int64(catMaps[0].JdID), // 到家分类
|
||||
BrandID: 35247,
|
||||
SkuName: mtSku.Name,
|
||||
SkuPrice: int(jxutils.StandardPrice2Int(mtSku.Price)),
|
||||
Weight: float64(jxutils.IntWeight2Float(utils.Str2Int(mtSku.SkuList[0].Weight))),
|
||||
FixedStatus: 1,
|
||||
IsSale: -1,
|
||||
Upc: mtSku.SkuList[0].Upc,
|
||||
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 != "" {
|
||||
param.ShopCategories = append(param.ShopCategories, utils.Str2Int64(catMap[mtSku.SecondaryCategoryCode]))
|
||||
} else if mtSku.CategoryCode != "" {
|
||||
|
||||
Reference in New Issue
Block a user