京东物料struct修改
This commit is contained in:
@@ -76,10 +76,10 @@ type AddOrderParam struct {
|
|||||||
ConsigneeMobile string `json:"consigneeMobile"` //收货人手机(收货人电话、手机至少有一个不为空),长度不能超30
|
ConsigneeMobile string `json:"consigneeMobile"` //收货人手机(收货人电话、手机至少有一个不为空),长度不能超30
|
||||||
ConsigneeAddress string `json:"consigneeAddress"` //收货人地址 ,长度不能超100
|
ConsigneeAddress string `json:"consigneeAddress"` //收货人地址 ,长度不能超100
|
||||||
OrderMark string `json:"orderMark"` //订单标记位,首位为1代表货到付款
|
OrderMark string `json:"orderMark"` //订单标记位,首位为1代表货到付款
|
||||||
// GoodsNo string `json:"goodsNo"` //ECLP商品编号,与商家商品编号二选一必填(两者都指定,以goodsNo为准)
|
GoodsNo string `json:"goodsNo"` //ECLP商品编号,与商家商品编号二选一必填(两者都指定,以goodsNo为准)
|
||||||
Price string `json:"price"` //商品金额,会在订单面单上线上商品单价
|
Price string `json:"price"` //商品金额,会在订单面单上线上商品单价
|
||||||
Quantity string `json:"quantity"` //商品的出库数量,必须>0
|
Quantity string `json:"quantity"` //商品的出库数量,必须>0
|
||||||
IsvGoodsNo string `json:"isvGoodsNo"` //商家商品编码
|
// IsvGoodsNo string `json:"isvGoodsNo"` //商家商品编码
|
||||||
}
|
}
|
||||||
|
|
||||||
type AddOrderResult struct {
|
type AddOrderResult struct {
|
||||||
@@ -129,13 +129,11 @@ type SearchShopStockResult struct {
|
|||||||
RequestID string `json:"requestId"`
|
RequestID string `json:"requestId"`
|
||||||
ErrMsg string `json:"errMsg"`
|
ErrMsg string `json:"errMsg"`
|
||||||
Data []struct {
|
Data []struct {
|
||||||
___ struct {
|
DeptNo string `json:"deptNo"`
|
||||||
DeptNo string `json:"deptNo"`
|
StockNum string `json:"stockNum"`
|
||||||
StockNum string `json:"stockNum"`
|
GoodsNo string `json:"goodsNo"`
|
||||||
GoodsNo string `json:"goodsNo"`
|
WarehouseNo string `json:"warehouseNo"`
|
||||||
WarehouseNo string `json:"warehouseNo"`
|
ShopNo string `json:"shopNo"`
|
||||||
ShopNo string `json:"shopNo"`
|
|
||||||
} `json:"___"`
|
|
||||||
} `json:"data"`
|
} `json:"data"`
|
||||||
PageSize string `json:"pageSize"`
|
PageSize string `json:"pageSize"`
|
||||||
PageNumber string `json:"pageNumber"`
|
PageNumber string `json:"pageNumber"`
|
||||||
@@ -279,9 +277,19 @@ func (a *API) GetTrackMessagePlusByOrder(bizCode string) (getTrackMessagePlusByO
|
|||||||
//查询仓库商品库存
|
//查询仓库商品库存
|
||||||
//https://open.jd.com/home/home#/doc/api?apiCateId=138&apiId=3396&apiName=jingdong.eclp.stock.searchShopStock
|
//https://open.jd.com/home/home#/doc/api?apiCateId=138&apiId=3396&apiName=jingdong.eclp.stock.searchShopStock
|
||||||
func (a *API) SearchShopStock(searchShopStockParam *SearchShopStockParam) (searchShopStockResult *SearchShopStockResult, err error) {
|
func (a *API) SearchShopStock(searchShopStockParam *SearchShopStockParam) (searchShopStockResult *SearchShopStockResult, err error) {
|
||||||
result, err := a.AccessAPI("jingdong.eclp.order.searchShopStock", prodURL, utils.Struct2FlatMap(searchShopStockParam))
|
params := map[string]interface{}{
|
||||||
|
"requestId": utils.GetUUID(),
|
||||||
|
"deptNo": DepartmentNo,
|
||||||
|
"shopNo": ShopNo,
|
||||||
|
"pageSize": 1000,
|
||||||
|
"pageNumber": 1,
|
||||||
|
}
|
||||||
|
if searchShopStockParam.GoodsNo != "" {
|
||||||
|
params["goodsNo"] = searchShopStockParam.GoodsNo
|
||||||
|
}
|
||||||
|
result, err := a.AccessAPI("jingdong.eclp.stock.searchShopStock", prodURL, params)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
utils.Map2StructByJson(result, &searchShopStockResult, false)
|
utils.Map2StructByJson(result["jingdong_eclp_stock_searchShopStock_responce"].(map[string]interface{})["shopStockSearchResponse"], &searchShopStockResult, false)
|
||||||
}
|
}
|
||||||
return searchShopStockResult, err
|
return searchShopStockResult, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,9 +42,10 @@ func TestAddOrder(t *testing.T) {
|
|||||||
ConsigneeMobile: "18160030913",
|
ConsigneeMobile: "18160030913",
|
||||||
ConsigneeAddress: "成都市金牛区",
|
ConsigneeAddress: "成都市金牛区",
|
||||||
OrderMark: OrderMark,
|
OrderMark: OrderMark,
|
||||||
IsvGoodsNo: "JX10012,JX10011",
|
// IsvGoodsNo: "JX10012,JX10011",
|
||||||
Price: "0,0",
|
Price: "0,0",
|
||||||
Quantity: "1,2",
|
Quantity: "1,2",
|
||||||
|
GoodsNo: "EMG4418111927871,EMG4418111927871",
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
@@ -59,19 +60,30 @@ func TestCancelOrder(t *testing.T) {
|
|||||||
t.Log(utils.Format4Output(result, false))
|
t.Log(utils.Format4Output(result, false))
|
||||||
}
|
}
|
||||||
func TestQueryOrderStatus(t *testing.T) {
|
func TestQueryOrderStatus(t *testing.T) {
|
||||||
result, err := api.QueryOrderStatus("ESL96778165421301")
|
result, err := api.QueryOrderStatus("ESL96778164878526")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
t.Log(utils.Format4Output(result, false))
|
t.Log(utils.Format4Output(result, false))
|
||||||
}
|
}
|
||||||
func TestGetTrackMessagePlusByOrder(t *testing.T) {
|
func TestGetTrackMessagePlusByOrder(t *testing.T) {
|
||||||
result, err := api.GetTrackMessagePlusByOrder("46526340012148")
|
result, err := api.GetTrackMessagePlusByOrder("46304726013148")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
t.Log(utils.Format4Output(result, false))
|
t.Log(utils.Format4Output(result, false))
|
||||||
}
|
}
|
||||||
func TestSearchShopStock(t *testing.T) {
|
func TestSearchShopStock(t *testing.T) {
|
||||||
api.SearchShopStock(&SearchShopStockParam{})
|
result, err := api.SearchShopStock(&SearchShopStockParam{
|
||||||
|
RequestId: utils.GetUUID(),
|
||||||
|
DeptNo: DepartmentNo,
|
||||||
|
ShopNo: ShopNo,
|
||||||
|
PageSize: 1000,
|
||||||
|
// GoodsNo: "EMG4418111359846",
|
||||||
|
PageNumber: 1,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
t.Log(utils.Format4Output(result, false))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user