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 }