jdeclp
This commit is contained in:
@@ -221,8 +221,8 @@ type WaybillReceiveParam struct {
|
||||
// GoodsCount int `json:"goodsCount"` //否 无 寄托物数量
|
||||
PromiseTimeType int `json:"promiseTimeType"` //否 无 产品类型(1:特惠送 2:特快送 4:城际闪送 5:同城当日达 6:次晨达 7:微小件 8: 生鲜专送 16:生鲜特快 17、生鲜特惠 21:特惠小包)
|
||||
// Freight int `json:"freight"` //否 无 运费
|
||||
PickUpStartTime time.Time `json:"pickUpStartTime"` //否 1 预约取件开始时间
|
||||
PickUpEndTime time.Time `json:"pickUpEndTime"` //否 1 预约取件结束时间
|
||||
PickUpStartTime time.Time `json:"pickUpStartTime,omitempty"` //否 1 预约取件开始时间
|
||||
PickUpEndTime time.Time `json:"pickUpEndTime,omitempty"` //否 1 预约取件结束时间
|
||||
// UnpackingInspection string `json:"unpackingInspection"` //否 无 开箱验货标识
|
||||
// BoxCode []string `json:"boxCode"` //否 无 商家箱号,多个箱号请用逗号分隔,例如三个箱号为:a123,b456,c789
|
||||
// FileURL string `json:"fileUrl"` //否 无 文件url
|
||||
@@ -417,7 +417,7 @@ func (a *API) QueryStock(goodsNo string) (queryStockResult []*QueryStockResult,
|
||||
func (a *API) WaybillReceive(waybillReceiveParam *WaybillReceiveParam) (deliveryId string, err error) {
|
||||
result, err := a.AccessAPI("jingdong.ldop.waybill.receive", prodURL, utils.Struct2FlatMap(waybillReceiveParam))
|
||||
if err == nil {
|
||||
deliveryId = result["jingdong_ldop_waybill_receive_responce"].(map[string]map[string]string)["receiveorderinfo_result"]["deliveryId"]
|
||||
deliveryId = result["jingdong_ldop_waybill_receive_responce"].(map[string]interface{})["receiveorderinfo_result"].(map[string]interface{})["deliveryId"].(string)
|
||||
}
|
||||
return deliveryId, err
|
||||
}
|
||||
@@ -429,19 +429,34 @@ func (a *API) CancelWayBill(cancelWayBillParam *CancelWayBillParam) (err error)
|
||||
return err
|
||||
}
|
||||
|
||||
type QueryDynamicTraceInfoResult struct {
|
||||
OpeTitle string `json:"opeTitle"`
|
||||
OpeTime string `json:"opeTime"`
|
||||
State string `json:"state"`
|
||||
OpeRemark string `json:"opeRemark"`
|
||||
OpeName string `json:"opeName"`
|
||||
WaybillCode string `json:"waybillCode"`
|
||||
}
|
||||
|
||||
//京东物流全程跟踪接口
|
||||
//https://open.jd.com/home/home#/doc/api?apiCateId=64&apiId=4257&apiName=jingdong.trace.dynamicQueryService.queryDynamicTraceInfo
|
||||
func (a *API) QueryDynamicTraceInfo(waybillCode string) (err error) {
|
||||
_, err = a.AccessAPI("jingdong.trace.dynamicQueryService.queryDynamicTraceInfo", prodURL, map[string]interface{}{
|
||||
"waybillCode": waybillCode,
|
||||
func (a *API) QueryDynamicTraceInfo(waybillCode string) (queryDynamicTraceInfo []*QueryDynamicTraceInfoResult, err error) {
|
||||
result, err := a.AccessAPI("jingdong.trace.dynamicQueryService.queryDynamicTraceInfo", prodURL, map[string]interface{}{
|
||||
"waybillCode": waybillCode,
|
||||
"customerCode": CustomerCode,
|
||||
})
|
||||
return err
|
||||
if err == nil {
|
||||
utils.Map2StructByJson(result["jingdong_trace_dynamicQueryService_queryDynamicTraceInfo_responce"].(map[string]interface{})["response"].(map[string]interface{})["data"], &queryDynamicTraceInfo, false)
|
||||
}
|
||||
return queryDynamicTraceInfo, err
|
||||
}
|
||||
|
||||
type WaybillQueryResult struct {
|
||||
Weight float64 `json:"weight"`
|
||||
DeliveryID string `json:"deliveryId"`
|
||||
GoodNumber int `json:"goodNumber"`
|
||||
Weight float64 `json:"weight"`
|
||||
DeliveryID string `json:"deliveryId"`
|
||||
GoodNumber int `json:"goodNumber"`
|
||||
StatusCode int `json:"statusCode"`
|
||||
StatusMessage string `json:"statusMessage"`
|
||||
}
|
||||
|
||||
//京东物流运单查询
|
||||
@@ -454,5 +469,8 @@ func (a *API) WaybillQuery(deliveryId string) (waybill *WaybillQueryResult, err
|
||||
if err == nil {
|
||||
utils.Map2StructByJson(result["jingdong_ldop_waybill_query_responce"].(map[string]interface{})["resultInfo"].(map[string]interface{})["data"], &waybill, false)
|
||||
}
|
||||
if waybill == nil {
|
||||
utils.Map2StructByJson(result["jingdong_ldop_waybill_query_responce"].(map[string]interface{})["resultInfo"], &waybill, false)
|
||||
}
|
||||
return waybill, err
|
||||
}
|
||||
|
||||
@@ -94,10 +94,10 @@ func TestWaybillReceive(t *testing.T) {
|
||||
SalePlat: SalePlatSourceDelivery,
|
||||
CustomerCode: CustomerCode,
|
||||
OrderID: "883289609977992",
|
||||
SenderName: "金牛店",
|
||||
SenderName: "测试别派件",
|
||||
SenderAddress: "四川省成都市金牛区加州湾v派",
|
||||
SenderTel: "18160030913",
|
||||
ReceiveName: "明珠怡园",
|
||||
ReceiveName: "后面会取消",
|
||||
ReceiveAddress: "四川省成都市天府大道",
|
||||
ReceiveTel: "18160030913",
|
||||
PackageCount: 1,
|
||||
@@ -114,7 +114,7 @@ func TestWaybillReceive(t *testing.T) {
|
||||
|
||||
func TestCancelWayBill(t *testing.T) {
|
||||
err := api.CancelWayBill(&CancelWayBillParam{
|
||||
WaybillCode: "JDVD00717018403",
|
||||
WaybillCode: "JDVD01096487452",
|
||||
CustomerCode: CustomerCode,
|
||||
Source: "JOS",
|
||||
CancelReason: "测试",
|
||||
@@ -126,8 +126,16 @@ func TestCancelWayBill(t *testing.T) {
|
||||
// t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
func TestWaybillQuery(t *testing.T) {
|
||||
result, err := api.WaybillQuery("JDVD01093075824")
|
||||
func TestQueryDynamicTraceInfo(t *testing.T) {
|
||||
result, err := api.QueryDynamicTraceInfo("JDVD01096487452")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
func TestWaybillQuery(t *testing.T) {
|
||||
result, err := api.WaybillQuery("JDVD01096487452")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user