jd 查询物流重量

This commit is contained in:
苏尹岚
2020-10-28 09:36:13 +08:00
parent 987afdd42e
commit 9eefd9a729
3 changed files with 38 additions and 302 deletions

View File

@@ -437,3 +437,22 @@ func (a *API) QueryDynamicTraceInfo(waybillCode string) (err error) {
})
return err
}
type WaybillQueryResult struct {
Weight float64 `json:"weight"`
DeliveryID string `json:"deliveryId"`
GoodNumber int `json:"goodNumber"`
}
//京东物流运单查询
//https://open.jd.com/home/home#/doc/api?apiCateId=64&apiId=2189&apiName=jingdong.ldop.waybill.query
func (a *API) WaybillQuery(deliveryId string) (waybill *WaybillQueryResult, err error) {
result, err := a.AccessAPI("jingdong.ldop.waybill.query", prodURL, map[string]interface{}{
"deliveryId": deliveryId,
"customerCode": CustomerCode,
})
if err == nil {
utils.Map2StructByJson(result["jingdong_ldop_waybill_query_responce"].(map[string]interface{})["resultInfo"].(map[string]interface{})["data"], &waybill, false)
}
return waybill, err
}