From e001529572a59df0fa33352dfdbb7738f98848b8 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:23:38 +0800 Subject: [PATCH] 1 --- platformapi/fnpsapi/callback.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/platformapi/fnpsapi/callback.go b/platformapi/fnpsapi/callback.go index fe0019ef..36924114 100644 --- a/platformapi/fnpsapi/callback.go +++ b/platformapi/fnpsapi/callback.go @@ -116,18 +116,23 @@ type AbnormalReportNotify struct { // 获取门店状态回调消息 func (a *API) GetChainstoreStatusNotify(request *http.Request) (shopStatusMsg *ChainstoreStatusNotify, callbackResponse *CallbackResponse) { - storeNotify := ShortStatus{} - err := utils.Map2StructByJson(utils.URLValues2Map(request.PostForm), &storeNotify, true) + data, err := ioutil.ReadAll(request.Body) if err != nil { + callbackResponse = &CallbackResponse{Code: -1} + return nil, callbackResponse + } + + 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) callbackResponse = &CallbackResponse{Code: -1} return nil, callbackResponse } - fmt.Println("回调数据=============================", storeNotify.BusinessData) + fmt.Println("回调数据=============================", storeNotify["business_data"]) fnNotify := &ChainstoreStatusNotify{} - 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) + if err := json.Unmarshal([]byte(utils.Interface2String(storeNotify["business_data"])), fnNotify); err != nil { + baseapi.SugarLogger.Debugf("FN callback string to GetChainstoreStatusNotify failed with err:%v", err) callbackResponse = &CallbackResponse{Code: -1} return nil, callbackResponse }