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))
sig = strings.Join(valueList, "&")
fmt.Println("sig", sig)
key := []byte(a.secretKey)
mac := hmac.New(sha1.New, key)
mac.Write([]byte(sig))

View File

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