41 lines
1.4 KiB
Go
41 lines
1.4 KiB
Go
package pddapi
|
|
|
|
import "git.rosy.net.cn/baseapi/utils"
|
|
|
|
type GoodsCatsGetResult struct {
|
|
CatName string `json:"cat_name"`
|
|
Level int `json:"level"`
|
|
CatID int `json:"cat_id"`
|
|
ParentCatID int `json:"parent_cat_id"`
|
|
}
|
|
|
|
//多多进宝商品类目查询
|
|
func (a *API) GoodsCatsGet(catID int) (goodsCatsGetResult []*GoodsCatsGetResult, err error) {
|
|
result, err := a.AccessAPI("pdd.goods.cats.get", false, map[string]interface{}{
|
|
"parent_cat_id": catID,
|
|
})
|
|
if err == nil {
|
|
utils.Map2StructByJson(result["goods_cats_get_response"].(map[string]interface{})["goods_cats_list"], &goodsCatsGetResult, false)
|
|
}
|
|
return goodsCatsGetResult, err
|
|
}
|
|
|
|
type GoodsSearchParam struct {
|
|
CatID int `json:"cat_id,omitempty"`
|
|
GoodsSignList []string `json:"goods_sign_list,omitempty"`
|
|
Keyword string `json:"keyword,omitempty"`
|
|
ListID string `json:"list_id,omitempty"`
|
|
Page int `json:"page,omitempty"`
|
|
PageSize int `json:"page_size,omitempty"`
|
|
SortType int `json:"sort_type,omitempty"`
|
|
}
|
|
|
|
//多多进宝商品查询
|
|
func (a *API) GoodsSearch(goodsSearchParam *GoodsSearchParam) (resourceURLGenResult *ResourceURLGenResult, err error) {
|
|
result, err := a.AccessAPI("pdd.ddk.goods.search", false, utils.Struct2FlatMap(goodsSearchParam))
|
|
if err == nil {
|
|
utils.Map2StructByJson(result["resource_url_response"], &resourceURLGenResult, false)
|
|
}
|
|
return resourceURLGenResult, err
|
|
}
|