This commit is contained in:
邹宗楠
2022-04-02 09:33:04 +08:00
parent 7bc1b718a0
commit 5b3ac2cba3

View File

@@ -2,9 +2,7 @@ package fnpsapi
import ( import (
"encoding/json" "encoding/json"
"fmt"
"git.rosy.net.cn/baseapi" "git.rosy.net.cn/baseapi"
"git.rosy.net.cn/baseapi/utils"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
) )
@@ -125,16 +123,15 @@ func (a *API) GetChainstoreStatusNotify(request *http.Request) (shopStatusMsg *C
return nil, callbackResponse return nil, callbackResponse
} }
storeNotify := make(map[string]interface{}, 4) storeNotify := &ShortStatus{}
if err := json.Unmarshal(data, &storeNotify); err != nil { if err := json.Unmarshal(data, &storeNotify); err != nil {
baseapi.SugarLogger.Debugf("FN GetChainstoreStatusNotify failed with err:%v", err) baseapi.SugarLogger.Debugf("FN GetChainstoreStatusNotify failed with err:%v", err)
callbackResponse = &CallbackResponse{Code: -1} callbackResponse = &CallbackResponse{Code: -1}
return nil, callbackResponse return nil, callbackResponse
} }
fmt.Println("回调数据=============================", storeNotify["business_data"])
fnNotify := &ChainstoreStatusNotify{} fnNotify := &ChainstoreStatusNotify{}
if err := json.Unmarshal([]byte(utils.Interface2String(storeNotify["business_data"])), fnNotify); err != nil { if err := json.Unmarshal([]byte(storeNotify.BusinessData), fnNotify); err != nil {
baseapi.SugarLogger.Debugf("FN callback string to GetChainstoreStatusNotify failed with err:%v", err) baseapi.SugarLogger.Debugf("FN callback string to GetChainstoreStatusNotify failed with err:%v", err)
callbackResponse = &CallbackResponse{Code: -1} callbackResponse = &CallbackResponse{Code: -1}
return nil, callbackResponse return nil, callbackResponse
@@ -152,8 +149,6 @@ func (a *API) GetChainOrderStatusNotify(request *http.Request) (shopStatusMsg *O
return nil, callbackResponse return nil, callbackResponse
} }
//if true { // 第二次平台分配骑手
fmt.Println("==============", string(data))
result := &ShortStatus{} result := &ShortStatus{}
if err := json.Unmarshal(data, &result); err != nil { if err := json.Unmarshal(data, &result); err != nil {
callbackResponse = &CallbackResponse{Code: -1} callbackResponse = &CallbackResponse{Code: -1}
@@ -165,9 +160,6 @@ func (a *API) GetChainOrderStatusNotify(request *http.Request) (shopStatusMsg *O
callbackResponse = &CallbackResponse{Code: -1} callbackResponse = &CallbackResponse{Code: -1}
return nil, callbackResponse return nil, callbackResponse
} }
fmt.Println("==============orderResult", orderResult)
fmt.Println("==============orderResult", orderResult.Param)
fmt.Println("==============orderResult", orderResult.Param.PartnerOrderCode)
return orderResult, SuccessResponse return orderResult, SuccessResponse
} }
@@ -180,15 +172,15 @@ func (a *API) GetChainAbnormaltatusNotify(request *http.Request) (shopStatusMsg
return nil, callbackResponse return nil, callbackResponse
} }
storeNotify := make(map[string]interface{}, 4) storeNotify := &ShortStatus{}
if err := json.Unmarshal(data, &storeNotify); err != nil { if err := json.Unmarshal(data, &storeNotify); err != nil {
baseapi.SugarLogger.Debugf("FN GetShopStatusCallbackMsg failed with err:%v", err) baseapi.SugarLogger.Debugf("FN GetShopStatusCallbackMsg failed with err:%v", err)
callbackResponse = &CallbackResponse{Code: -1} callbackResponse = &CallbackResponse{Code: -1}
return nil, callbackResponse return nil, callbackResponse
} }
fmt.Println("======================", storeNotify)
fnNotify := &AbnormalStatusNotify{} fnNotify := &AbnormalStatusNotify{}
if err := json.Unmarshal([]byte(utils.Interface2String(storeNotify["business_data"])), fnNotify); err != nil { if err := json.Unmarshal([]byte(storeNotify.BusinessData), fnNotify); err != nil {
baseapi.SugarLogger.Debugf("FN callback string to ChainstoreStatusNotify failed with err:%v", err) baseapi.SugarLogger.Debugf("FN callback string to ChainstoreStatusNotify failed with err:%v", err)
callbackResponse = &CallbackResponse{Code: -1} callbackResponse = &CallbackResponse{Code: -1}
return nil, callbackResponse return nil, callbackResponse