This commit is contained in:
苏尹岚
2020-11-26 16:07:08 +08:00
parent 2cfd3075bb
commit a5cb1b89bd
4 changed files with 73 additions and 61 deletions

View File

@@ -534,14 +534,45 @@ func (a *API) FindSkuById(skuId int64) (findSkuByIdParam *FindSkuByIdParam, err
return findSkuByIdParam, err
}
type FindWareByIdResult struct {
MultiCategoryID int `json:"multiCategoryId"`
BrandID int `json:"brandId"`
Height int `json:"height"`
Features []struct {
FeatureValue string `json:"featureValue"`
FeatureKey string `json:"featureKey"`
} `json:"features"`
OfflineTime int64 `json:"offlineTime"`
WareID int64 `json:"wareId"`
WareStatus int `json:"wareStatus"`
CategoryID int `json:"categoryId"`
Width int `json:"width"`
OnlineTime int64 `json:"onlineTime"`
Images []struct {
ImgURL string `json:"imgUrl"`
ImgID int64 `json:"imgId"`
ColorID string `json:"colorId"`
ImgIndex int `json:"imgIndex"`
} `json:"images"`
OuterID string `json:"outerId"`
Weight float64 `json:"weight"`
Title string `json:"title"`
Length int `json:"length"`
ItemNum string `json:"itemNum"`
ColType int `json:"colType"`
}
//获取单个商品
//https://open.jd.com/home/home#/doc/api?apiCateId=48&apiId=1244&apiName=jingdong.ware.read.findWareById
func (a *API) FindWareById(wareId int64) (err error) {
_, err = a.AccessAPI2("jingdong.ware.read.findWareById", prodURL, map[string]interface{}{
func (a *API) FindWareById(wareId int64) (findWareByIdResult *FindWareByIdResult, err error) {
result, err := a.AccessAPI2("jingdong.ware.read.findWareById", prodURL, map[string]interface{}{
"wareId": wareId,
"field": "skus,features,weight,width,height,length,images,wareStatus,categoryId,brandId,colType",
"field": "features,weight,width,height,length,images,wareStatus,categoryId,brandId",
})
return err
if err == nil {
utils.Map2StructByJson(result["jingdong_ware_read_findWareById_responce"].(map[string]interface{})["ware"], &findWareByIdResult, false)
}
return findWareByIdResult, err
}
//更新商品市场价