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 }