京东商城订单result

This commit is contained in:
苏尹岚
2020-07-22 14:39:20 +08:00
parent 7b8f28c97a
commit a62b19d1db

View File

@@ -44,67 +44,62 @@ func (a *API) GetDeliveryCompany() (result interface{}, err error) {
}
type GetOrderResult struct {
JingdongPopOrderGetResponce struct {
Code string `json:"code"`
OrderDetailInfo struct {
OrderInfo struct {
OrderStateRemark string `json:"orderStateRemark"`
OrderRemark string `json:"orderRemark"`
OrderSellerPrice string `json:"orderSellerPrice"`
OrderState string `json:"orderState"`
OrderType string `json:"orderType"`
ConsigneeInfo struct {
ProvinceID string `json:"provinceId"`
FullAddress string `json:"fullAddress"`
CityID string `json:"cityId"`
TownID string `json:"townId"`
City string `json:"city"`
County string `json:"county"`
Province string `json:"province"`
Town string `json:"town"`
Telephone string `json:"telephone"`
Fullname string `json:"fullname"`
CountyID string `json:"countyId"`
Mobile string `json:"mobile"`
} `json:"consigneeInfo"`
OrderPayment string `json:"orderPayment"`
PayType string `json:"payType"`
ItemInfoList []struct {
ProductNo string `json:"productNo"`
ItemTotal string `json:"itemTotal"`
JdPrice string `json:"jdPrice"`
SkuName string `json:"skuName"`
InvoiceContentID string `json:"invoiceContentId"`
ItemExt string `json:"itemExt"`
NewStoreID string `json:"newStoreId"`
OuterSkuID string `json:"outerSkuId"`
SkuID string `json:"skuId"`
WareID string `json:"wareId"`
GiftPoint string `json:"giftPoint"`
} `json:"itemInfoList"`
StoreID string `json:"storeId"`
OrderTotalPrice string `json:"orderTotalPrice"`
OrderExt string `json:"orderExt"`
StoreOrder string `json:"storeOrder"`
OrderStartTime string `json:"orderStartTime"`
OrderID string `json:"orderId"`
OrderSource string `json:"orderSource"`
FreightPrice string `json:"freightPrice"`
} `json:"orderInfo"`
APIResult struct {
EnglishErrCode string `json:"englishErrCode"`
Success bool `json:"success"`
ChineseErrCode string `json:"chineseErrCode"`
NumberCode int `json:"numberCode"`
} `json:"apiResult"`
} `json:"orderDetailInfo"`
} `json:"jingdong_pop_order_get_responce"`
OrderInfo struct {
OrderStateRemark string `json:"orderStateRemark"`
OrderRemark string `json:"orderRemark"`
OrderSellerPrice string `json:"orderSellerPrice"`
OrderState string `json:"orderState"`
OrderType string `json:"orderType"`
ConsigneeInfo struct {
ProvinceID string `json:"provinceId"`
FullAddress string `json:"fullAddress"`
CityID string `json:"cityId"`
TownID string `json:"townId"`
City string `json:"city"`
County string `json:"county"`
Province string `json:"province"`
Town string `json:"town"`
Telephone string `json:"telephone"`
Fullname string `json:"fullname"`
CountyID string `json:"countyId"`
Mobile string `json:"mobile"`
} `json:"consigneeInfo"`
OrderPayment string `json:"orderPayment"`
PayType string `json:"payType"`
ItemInfoList []struct {
ProductNo string `json:"productNo"`
ItemTotal string `json:"itemTotal"`
JdPrice string `json:"jdPrice"`
SkuName string `json:"skuName"`
InvoiceContentID string `json:"invoiceContentId"`
ItemExt string `json:"itemExt"`
NewStoreID string `json:"newStoreId"`
OuterSkuID string `json:"outerSkuId"`
SkuID string `json:"skuId"`
WareID string `json:"wareId"`
GiftPoint string `json:"giftPoint"`
} `json:"itemInfoList"`
StoreID string `json:"storeId"`
OrderTotalPrice string `json:"orderTotalPrice"`
OrderExt string `json:"orderExt"`
StoreOrder string `json:"storeOrder"`
OrderStartTime string `json:"orderStartTime"`
OrderID string `json:"orderId"`
OrderSource string `json:"orderSource"`
FreightPrice string `json:"freightPrice"`
} `json:"orderInfo"`
APIResult struct {
EnglishErrCode string `json:"englishErrCode"`
Success bool `json:"success"`
ChineseErrCode string `json:"chineseErrCode"`
NumberCode int `json:"numberCode"`
} `json:"apiResult"`
}
//查询单个订单
//https://open.jd.com/home/home#/doc/api?apiCateId=55&apiId=4247&apiName=jingdong.pop.order.get
func (a *API) GetOrder(orderID int64) (err error) {
_, err = a.AccessAPI("jingdong.pop.order.get", prodURL, map[string]interface{}{
func (a *API) GetOrder(orderID int64) (getOrderResult *GetOrderResult, err error) {
result, err := a.AccessAPI("jingdong.pop.order.get", prodURL, map[string]interface{}{
"order_id": orderID,
"optional_fields": `orderType,payType,orderTotalPrice,orderSellerPrice,
orderPayment,freightPrice,orderState,orderStateRemark,
@@ -112,7 +107,10 @@ func (a *API) GetOrder(orderID int64) (err error) {
itemInfoList,pauseBizInfo`,
"order_state": "WAIT_SELLER_STOCK_OUT,PAUSE",
})
return err
if err == nil {
utils.Map2StructByJson(result["jingdong_pop_order_get_responce"].(map[string]interface{})["orderDetailInfo"].(map[string]interface{})["orderInfo"], &getOrderResult, false)
}
return getOrderResult, err
}
type VoucherInfoGetResult struct {