jds订单整起

This commit is contained in:
苏尹岚
2020-07-31 09:30:35 +08:00
parent 92136bd93f
commit b8df7dbdac
2 changed files with 12 additions and 10 deletions

View File

@@ -78,7 +78,6 @@ func (a *API) signParam(params map[string]interface{}) (sig string) {
} }
sort.Sort(sort.StringSlice(valueList)) sort.Sort(sort.StringSlice(valueList))
sig = strings.Join(valueList, "&") sig = strings.Join(valueList, "&")
fmt.Println("sig", sig)
key := []byte(a.secretKey) key := []byte(a.secretKey)
mac := hmac.New(sha1.New, key) mac := hmac.New(sha1.New, key)
mac.Write([]byte(sig)) mac.Write([]byte(sig))

View File

@@ -15,6 +15,7 @@ const (
OrderStatusPopPause = "POP_ORDER_PAUSE" OrderStatusPopPause = "POP_ORDER_PAUSE"
OrderStatusPause = "PAUSE" OrderStatusPause = "PAUSE"
OrderStatusWait = "WAIT_SELLER_STOCK_OUT" OrderStatusWait = "WAIT_SELLER_STOCK_OUT"
OrderStatusCancel = "TRADE_CANCELED"
) )
//订单出库 //订单出库
@@ -97,15 +98,17 @@ type GetOrderResult struct {
//查询单个订单 //查询单个订单
//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) (getOrderResult *GetOrderResult, err error) { func (a *API) GetOrder(orderID int64, isStatus bool) (getOrderResult *GetOrderResult, err error) {
result, err := a.AccessAPI("jingdong.pop.order.get", prodURL, map[string]interface{}{ params := make(map[string]interface{})
"order_id": orderID, params["order_id"] = orderID
"optional_fields": `orderType,payType,orderTotalPrice,orderSellerPrice, params["optional_fields"] = `orderType,payType,orderTotalPrice,orderSellerPrice,
orderPayment,freightPrice,orderState,orderStateRemark, orderPayment,freightPrice,orderState,orderStateRemark,
orderStartTime,orderEndTime,orderRemark,consigneeInfo, orderStartTime,orderEndTime,orderRemark,consigneeInfo,
itemInfoList,pauseBizInfo,pin`, itemInfoList,pauseBizInfo,pin`
"order_state": "WAIT_SELLER_STOCK_OUT,PAUSE", if isStatus {
}) params["order_state"] = "WAIT_SELLER_STOCK_OUT,PAUSE"
}
result, err := a.AccessAPI("jingdong.pop.order.get", prodURL, params)
if err == nil { if err == nil {
utils.Map2StructByJson(result["jingdong_pop_order_get_responce"].(map[string]interface{})["orderDetailInfo"].(map[string]interface{})["orderInfo"], &getOrderResult, false) utils.Map2StructByJson(result["jingdong_pop_order_get_responce"].(map[string]interface{})["orderDetailInfo"].(map[string]interface{})["orderInfo"], &getOrderResult, false)
} }