得到状态修改

This commit is contained in:
苏尹岚
2020-07-31 15:46:49 +08:00
parent b98d6b77fd
commit 980aea7b04

View File

@@ -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
}