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