京东商城获取类目信息
This commit is contained in:
@@ -45,6 +45,28 @@ func (a *API) DeleteShopCategory(cid int64) (uniteResp *UniteResp, err error) {
|
||||
return uniteResp, err
|
||||
}
|
||||
|
||||
type FindVendorCategoriesResult struct {
|
||||
ID int `json:"id"`
|
||||
Fid int `json:"fid"`
|
||||
AliasName string `json:"aliasName"`
|
||||
Lev int `json:"lev"`
|
||||
IndexID int `json:"indexId"`
|
||||
Status int `json:"status"`
|
||||
Created int64 `json:"created"`
|
||||
Name string `json:"name"`
|
||||
Modified int64 `json:"modified"`
|
||||
}
|
||||
|
||||
//查询商家所有的类目
|
||||
//https://open.jd.com/home/home#/doc/api?apiCateId=88&apiId=2727&apiName=jingdong.vender.category.getValidCategoryResultByVenderId
|
||||
func (a *API) FindVendorCategories() (findVendorCategoriesResult []*FindVendorCategoriesResult, err error) {
|
||||
result, err := a.AccessAPI("jingdong.vender.category.getValidCategoryResultByVenderId", prodURL, nil)
|
||||
if err == nil {
|
||||
utils.Map2StructByJson(result["jingdong_vender_category_getValidCategoryResultByVenderId_responce"].(map[string]interface{})["getvalidcategoryresultbyvenderid_result"].(map[string]interface{})["list"], &findVendorCategoriesResult, false)
|
||||
}
|
||||
return findVendorCategoriesResult, err
|
||||
}
|
||||
|
||||
//京东商城发布商品(创建商品?)
|
||||
//https://open.jd.com/home/home#/doc/api?apiCateId=48&apiId=1379&apiName=jingdong.ware.write.add
|
||||
func (a *API) CreateSku() (err error) {
|
||||
|
||||
@@ -21,3 +21,11 @@ func TestDeleteShopCategory(t *testing.T) {
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
func TestFindVendorCategories(t *testing.T) {
|
||||
result, err := api.FindVendorCategories()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user