53 lines
2.5 KiB
Go
53 lines
2.5 KiB
Go
package jdshopapi
|
||
|
||
import (
|
||
"fmt"
|
||
|
||
"git.rosy.net.cn/baseapi/utils"
|
||
)
|
||
|
||
type FindShopCategoriesResult struct {
|
||
CID int64 `json:"cid"` //123456 分类编号
|
||
VenderID int `json:"vender_id"` //123456 商家编号
|
||
ShopID int `json:"shop_id"` // 123456 店铺编号
|
||
ParentCID int64 `json:"parent_cid"` //123456 父分类编号
|
||
OrderNo int `json:"order_no"` //1 分类排序
|
||
Name string `json:"name"` //分类1 分类名称
|
||
IsOpen bool `json:"is_open"` //false 是否展开子分类(false,不展开;true,展开)
|
||
IsHomeShow bool `json:"is_home_show"` //false 是否在首页展示分类(false,前台不展示,true前台展示
|
||
Status int `json:"status"` // 1 状态(1:删除 1:正常)
|
||
CreateTime int64 `json:"create_time"` //1394089643000 创建时间
|
||
ModifyTime int64 `json:"modify_time"` // 修改时间。每修改一次此值都会发生变化。
|
||
}
|
||
|
||
//查询商家所有的店内分类
|
||
//https://open.jd.com/home/home#/doc/api?apiCateId=88&apiId=2801&apiName=jingdong.vender.shopcategory.findShopCategoriesByVenderId
|
||
func (a *API) FindShopCategories() (findShopCategoriesResult []*FindShopCategoriesResult, err error) {
|
||
result, err := a.AccessAPI("jingdong.vender.shopcategory.findShopCategoriesByVenderId", prodURL, nil)
|
||
if err == nil {
|
||
utils.Map2StructByJson(result["jingdong_vender_shopcategory_findShopCategoriesByVenderId_responce"].(map[string]interface{})["shopCategoryResult"].(map[string]interface{})["shop_category_list"], &findShopCategoriesResult, false)
|
||
}
|
||
return findShopCategoriesResult, err
|
||
}
|
||
|
||
//删除店内分类
|
||
//https://open.jd.com/home/home#/doc/api?apiCateId=88&apiId=3031&apiName=jingdong.vender.shopcategory.deleteShopCategoryByVenderIdAndCid
|
||
func (a *API) DeleteShopCategory(cid int64) (uniteResp *UniteResp, err error) {
|
||
result, err := a.AccessAPI("jingdong.vender.shopcategory.deleteShopCategoryByVenderIdAndCid", prodURL, map[string]interface{}{
|
||
"cid": cid,
|
||
})
|
||
if err == nil {
|
||
utils.Map2StructByJson(result["jingdong_vender_shopcategory_deleteShopCategoryByVenderIdAndCid_responce"].(map[string]interface{})["shopCategoryResult"], &uniteResp, false)
|
||
if !uniteResp.IsSuccess {
|
||
return nil, fmt.Errorf(uniteResp.ErrorMsgCn)
|
||
}
|
||
}
|
||
return uniteResp, err
|
||
}
|
||
|
||
//京东商城发布商品(创建商品?)
|
||
//https://open.jd.com/home/home#/doc/api?apiCateId=48&apiId=1379&apiName=jingdong.ware.write.add
|
||
func (a *API) CreateSku() (err error) {
|
||
return err
|
||
}
|