From 980aea7b04da8a4143473e53d8b7ed7b58b5a7a3 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 15:46:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=97=E5=88=B0=E7=8A=B6=E6=80=81=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jdshop/order.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/business/partner/purchase/jdshop/order.go b/business/partner/purchase/jdshop/order.go index 0afe3cf4f..0e605f0e6 100644 --- a/business/partner/purchase/jdshop/order.go +++ b/business/partner/purchase/jdshop/order.go @@ -1,6 +1,7 @@ package jdshop import ( + "encoding/json" "fmt" "net/http" "strings" @@ -50,7 +51,9 @@ func (p *PurchaseHandler) GetOrderStatus(vendorOrgCode, vendorOrderID string) (s params["orderID"] = vendorOrderID params["token"] = "JxCaIsHiGetJsdOrderTmpToken_20200731" result, err := apiToYd("order/GetJdsOrder", params) - return status2Jxstatus(result["orderState"].(string)), err + jdsOrder := &jdshopapi.GetOrderResult{} + json.Unmarshal([]byte(strings.ReplaceAll(result["data"].(string), "\\", "")), &jdsOrder) + return status2Jxstatus(jdsOrder.OrderState), err } func (p *PurchaseHandler) AcceptOrRefuseOrder(order *model.GoodsOrder, isAcceptIt bool, userName string) (err error) { @@ -193,9 +196,11 @@ func apiToYd(url string, params map[string]interface{}) (retVal map[string]inter } if err == nil { if jsonResult1["code"] != nil { - errLevel = platformapi.ErrLevelGeneralFail - err = utils.NewErrorCode(jsonResult1["desc"].(string), jsonResult1["code"].(string)) - baseapi.SugarLogger.Debugf("yd AccessAPI failed, jsonResult1:%s", utils.Format4Output(jsonResult1, true)) + if utils.Interface2Int64WithDefault(jsonResult1["code"], 0) != 0 { + errLevel = platformapi.ErrLevelGeneralFail + err = utils.NewErrorCode(jsonResult1["desc"].(string), jsonResult1["code"].(string)) + baseapi.SugarLogger.Debugf("yd AccessAPI failed, jsonResult1:%s", utils.Format4Output(jsonResult1, true)) + } } retVal = jsonResult1 }