京东物流

This commit is contained in:
苏尹岚
2020-06-04 15:14:19 +08:00
parent 6a4077f441
commit 9b9f04ca3d
6 changed files with 57 additions and 19 deletions

View File

@@ -189,14 +189,14 @@ type WaybillReceiveParam struct {
// VloumLong int `json:"vloumLong"` //否 无 包裹长(单位cm,保留小数点后两位)
// VloumWidth int `json:"vloumWidth"` //否 无 包裹宽(单位cm保留小数点后两位)
// VloumHeight int `json:"vloumHeight"` //否 无 包裹高(单位cm保留小数点后两位)
Vloumn int `json:"vloumn"` //是 10000 体积(单位cm3保留小数点后两位)
// Description string `json:"description"` //否 无 商品描述
Vloumn int `json:"vloumn"` //是 10000 体积(单位cm3保留小数点后两位)
Description string `json:"description"` //否 无 商品描述
// CollectionValue int `json:"collectionValue"` //否 1 是否代收货款(是10。不填或者超出范围默认是0)
// CollectionMoney int `json:"collectionMoney"` //否 98.00 代收货款金额(保留小数点后两位)
// GuaranteeValue int `json:"guaranteeValue"` //否 1 是否保价(是10。不填或者超出范围默认是0)
// GuaranteeValueAmount int `json:"guaranteeValueAmount"` //否 100.00 保价金额(保留小数点后两位)
// SignReturn int `json:"signReturn"` //否 1 签单返还(签单返还类型0 不返单1 普通返单2 校验身份返单3 电子签返单4 电子返单+普通返单)
// Aging int `json:"aging"` //否 1 时效(普通1工作日2非工作日3晚间4。O2O一小时达5。O2O定时达6。不填或者超出范围默认是1)
Aging int `json:"aging"` //否 1 时效(普通1工作日2非工作日3晚间4。O2O一小时达5。O2O定时达6。不填或者超出范围默认是1)
// TransType int `json:"transType"` //否 1 运输类型(陆运1航空2。不填或者超出范围默认是1)
// Remark string `json:"remark"` //否 无 运单备注长度20,说明:打印面单时备注内容也会显示在快递面单上
// GoodsType int `json:"goodsType"` //否 无 配送业务类型( 1:普通3:填仓4:特配6:控温7:冷藏8:冷冻9:深冷默认是1
@@ -413,9 +413,12 @@ func (a *API) QueryStock(goodsNo string) (queryStockResult []*QueryStockResult,
//京东物流接单接口
//https://open.jd.com/home/home#/doc/api?apiCateId=64&apiId=2122&apiName=jingdong.ldop.waybill.receive
func (a *API) WaybillReceive(waybillReceiveParam *WaybillReceiveParam) (err error) {
_, err = a.AccessAPI("jingdong.ldop.waybill.receive", prodURL, utils.Struct2FlatMap(waybillReceiveParam))
return err
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"]
}
return deliveryId, err
}
//京东物流取消接口

View File

@@ -97,14 +97,18 @@ func TestWaybillReceive(t *testing.T) {
err := api.WaybillReceive(&WaybillReceiveParam{
SalePlat: SalePlatSourceDelivery,
CustomerCode: CustomerCode,
OrderID: utils.GetUUID(),
SenderName: "测试",
SenderAddress: "测试地址1",
ReceiveName: "测试",
ReceiveAddress: "测试地址1",
OrderID: "883289609977992",
SenderName: "金牛店",
SenderAddress: "四川省成都市金牛区加州湾v派",
SenderTel: "18160030913",
ReceiveName: "明珠怡园",
ReceiveAddress: "四川省成都市天府大道",
ReceiveTel: "18160030913",
PackageCount: 1,
Weight: 1,
Weight: 100,
Vloumn: 10000,
Description: "测试",
Aging: 5,
})
if err != nil {
t.Fatal(err)
@@ -114,7 +118,7 @@ func TestWaybillReceive(t *testing.T) {
func TestCancelWayBill(t *testing.T) {
err := api.CancelWayBill(&CancelWayBillParam{
WaybillCode: "11",
WaybillCode: "JDVD00717018403",
CustomerCode: CustomerCode,
Source: "JOS",
CancelReason: "测试",