From ec13b646b4006caf28489c0fac4c3ecd0e8523d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Thu, 31 Mar 2022 16:39:04 +0800 Subject: [PATCH] 1 --- platformapi/fnpsapi/callback.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/platformapi/fnpsapi/callback.go b/platformapi/fnpsapi/callback.go index bd304dce..afff3181 100644 --- a/platformapi/fnpsapi/callback.go +++ b/platformapi/fnpsapi/callback.go @@ -36,10 +36,10 @@ func Err2CallbackResponse(err error, data string) *CallbackResponse { } type ShortStatus struct { - AppId string `json:"app_id"` - Signature string `json:"signature"` - Timestamp string `json:"timestamp"` - BusinessData string `json:"business_data"` + AppId string `json:"app_id"` + Signature string `json:"signature"` + Timestamp string `json:"timestamp"` + BusinessData interface{} `json:"business_data"` } // 门店状态回调 @@ -125,7 +125,7 @@ func (a *API) GetChainstoreStatusNotify(request *http.Request) (shopStatusMsg *C fmt.Println("回调数据=============================", storeNotify.BusinessData) fnNotify := &ChainstoreStatusNotify{} - if err := json.Unmarshal([]byte(storeNotify.BusinessData), fnNotify); err != nil { + if err := json.Unmarshal([]byte(utils.Interface2String(storeNotify.BusinessData)), fnNotify); err != nil { baseapi.SugarLogger.Debugf("FN callback string to ChainstoreStatusNotify failed with err:%v", err) callbackResponse = &CallbackResponse{Code: -1} return nil, callbackResponse @@ -144,8 +144,9 @@ func (a *API) GetChainOrderStatusNotify(request *http.Request) (shopStatusMsg *O return nil, callbackResponse } + fmt.Println("======================", storeNotify) fnNotify := &OrderStatusNottify{} - if err := json.Unmarshal([]byte(storeNotify.BusinessData), fnNotify); err != nil { + if err := json.Unmarshal([]byte(utils.Interface2String(storeNotify.BusinessData)), fnNotify); err != nil { baseapi.SugarLogger.Debugf("FN callback string to ChainstoreStatusNotify failed with err:%v", err) callbackResponse = &CallbackResponse{Code: -1} return nil, callbackResponse @@ -163,9 +164,9 @@ func (a *API) GetChainAbnormaltatusNotify(request *http.Request) (shopStatusMsg callbackResponse = &CallbackResponse{Code: -1} return nil, callbackResponse } - + fmt.Println("======================", storeNotify) fnNotify := &AbnormalStatusNotify{} - if err := json.Unmarshal([]byte(storeNotify.BusinessData), fnNotify); err != nil { + if err := json.Unmarshal([]byte(utils.Interface2String(storeNotify.BusinessData)), fnNotify); err != nil { baseapi.SugarLogger.Debugf("FN callback string to ChainstoreStatusNotify failed with err:%v", err) callbackResponse = &CallbackResponse{Code: -1} return nil, callbackResponse