From e51658470514caa12004612f2192a5d9bc1ff77e 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 17:43:17 +0800 Subject: [PATCH] 1 --- platformapi/fnpsapi/callback.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/platformapi/fnpsapi/callback.go b/platformapi/fnpsapi/callback.go index f69c57d3..48e4ca1d 100644 --- a/platformapi/fnpsapi/callback.go +++ b/platformapi/fnpsapi/callback.go @@ -123,8 +123,8 @@ func (a *API) GetChainstoreStatusNotify(request *http.Request) (shopStatusMsg *C } storeNotify := make(map[string]interface{}, 4) - if err := utils.Map2StructByJson(data, storeNotify, true); err != nil { - baseapi.SugarLogger.Debugf("FN GetShopStatusCallbackMsg failed with err:%v", err) + if err := json.Unmarshal(data, storeNotify); err != nil { + baseapi.SugarLogger.Debugf("FN GetChainstoreStatusNotify failed with err:%v", err) callbackResponse = &CallbackResponse{Code: -1} return nil, callbackResponse } @@ -170,16 +170,22 @@ func (a *API) GetChainOrderStatusNotify(request *http.Request) (shopStatusMsg *O // 异常配送 func (a *API) GetChainAbnormaltatusNotify(request *http.Request) (shopStatusMsg *AbnormalStatusNotify, callbackResponse *CallbackResponse) { - storeNotify := ShortStatus{} - err := utils.Map2StructByJson(utils.URLValues2Map(request.PostForm), &storeNotify, true) + data, err := ioutil.ReadAll(request.Body) if err != nil { + baseapi.SugarLogger.Debugf("FN GetChainOrderStatusNotify failed with No result msg err:%v", err) + callbackResponse = &CallbackResponse{Code: -1} + return nil, callbackResponse + } + + storeNotify := make(map[string]interface{}, 4) + if err := json.Unmarshal(data, storeNotify); err != nil { baseapi.SugarLogger.Debugf("FN GetShopStatusCallbackMsg failed with err:%v", err) callbackResponse = &CallbackResponse{Code: -1} return nil, callbackResponse } fmt.Println("======================", storeNotify) fnNotify := &AbnormalStatusNotify{} - if err := json.Unmarshal([]byte(utils.Interface2String(storeNotify.BusinessData)), fnNotify); err != nil { + if err := json.Unmarshal([]byte(utils.Interface2String(storeNotify["business_data"])), fnNotify); err != nil { baseapi.SugarLogger.Debugf("FN callback string to ChainstoreStatusNotify failed with err:%v", err) callbackResponse = &CallbackResponse{Code: -1} return nil, callbackResponse