a
This commit is contained in:
@@ -83,7 +83,7 @@ func GetVendorCategoriesWithMap(ctx *jxcontext.Context, vendorID int) (vendorCat
|
||||
if vendorID != model.VendorIDMTWM {
|
||||
return nil, fmt.Errorf("只支持美团!")
|
||||
}
|
||||
return dao.GetVendorCategoriesWithMap(dao.GetDB(), vendorID)
|
||||
return dao.GetVendorCategoriesWithMap(dao.GetDB(), vendorID, 0)
|
||||
}
|
||||
|
||||
// parentID 为-1表示所有
|
||||
|
||||
@@ -5693,7 +5693,8 @@ func CopyMtToJd(ctx *jxcontext.Context, mtStoreID, mtOrgCode, jdStoreID, jdOrgCo
|
||||
mtSku := batchItemList[0].(*mtwmapi.AppFood)
|
||||
catMaps, _ := dao.GetMtJdCategoryMap(db, utils.Int2Str(mtSku.TagID), "")
|
||||
if len(catMaps) == 0 {
|
||||
return retVal, fmt.Errorf("该商品美团分类还未映射到京东,美团分类:[%v]。", mtSku.TagID)
|
||||
results, _ := dao.GetVendorCategoriesWithMap(db, model.VendorIDMTWM, mtSku.TagID)
|
||||
return retVal, fmt.Errorf("该商品美团分类还未映射到京东,商品名:[%v],美团分类:[%v]。", mtSku.Name, results[0].Name)
|
||||
}
|
||||
param := &jdapi.OpSkuParam{
|
||||
TraceID: ctx.GetTrackInfo(),
|
||||
|
||||
@@ -605,7 +605,7 @@ type GetVendorCategoriesWithMapResult struct {
|
||||
CatMapID string `orm:"column(cat_map_id)" json:"catMapID"`
|
||||
}
|
||||
|
||||
func GetVendorCategoriesWithMap(db *DaoDB, vendorID int) (results []*GetVendorCategoriesWithMapResult, err error) {
|
||||
func GetVendorCategoriesWithMap(db *DaoDB, vendorID, vendorCategoryID int) (results []*GetVendorCategoriesWithMapResult, err error) {
|
||||
sql := `
|
||||
SELECT a.*, b.jd_id cat_map_id
|
||||
FROM sku_vendor_category a
|
||||
@@ -613,6 +613,10 @@ func GetVendorCategoriesWithMap(db *DaoDB, vendorID int) (results []*GetVendorCa
|
||||
WHERE vendor_id = ?
|
||||
`
|
||||
sqlParams := []interface{}{vendorID}
|
||||
if vendorCategoryID != 0 {
|
||||
sql += " AND a.vendor_category_id = ?"
|
||||
sqlParams = append(sqlParams, vendorCategoryID)
|
||||
}
|
||||
GetRows(db, &results, sql, sqlParams)
|
||||
return results, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user