From b8df7dbdac85f52043c253464360919830a469d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 31 Jul 2020 09:30:35 +0800 Subject: [PATCH] =?UTF-8?q?jds=E8=AE=A2=E5=8D=95=E6=95=B4=E8=B5=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platformapi/jcqapi/jcqapi.go | 1 - platformapi/jdshopapi/order.go | 21 ++++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/platformapi/jcqapi/jcqapi.go b/platformapi/jcqapi/jcqapi.go index 1bc8ef1c..69573733 100644 --- a/platformapi/jcqapi/jcqapi.go +++ b/platformapi/jcqapi/jcqapi.go @@ -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)) diff --git a/platformapi/jdshopapi/order.go b/platformapi/jdshopapi/order.go index 912bb12c..0216fc39 100644 --- a/platformapi/jdshopapi/order.go +++ b/platformapi/jdshopapi/order.go @@ -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) }