- fix jd callback msg handling, some callback msg should unescqpe firstly.
This commit is contained in:
@@ -38,7 +38,7 @@ var (
|
||||
SuccessResponse = &CallbackResponse{"ok"}
|
||||
)
|
||||
|
||||
func (e *API) unmarshalData(data []byte, msg interface{}) (callbackResponse *CallbackResponse) {
|
||||
func (a *API) unmarshalData(data []byte, msg interface{}) (callbackResponse *CallbackResponse) {
|
||||
err := utils.UnmarshalUseNumber(data, msg)
|
||||
if err != nil {
|
||||
return &CallbackResponse{
|
||||
@@ -48,8 +48,8 @@ func (e *API) unmarshalData(data []byte, msg interface{}) (callbackResponse *Cal
|
||||
return nil
|
||||
}
|
||||
|
||||
func (e *API) CheckCallbackValidation(mapData map[string]interface{}) (callbackResponse *CallbackResponse) {
|
||||
sign := e.signParamsMap(mapData, "")
|
||||
func (a *API) CheckCallbackValidation(mapData map[string]interface{}) (callbackResponse *CallbackResponse) {
|
||||
sign := a.signParamsMap(mapData, "")
|
||||
if remoteSign, _ := mapData[signKey].(string); sign != remoteSign {
|
||||
baseapi.SugarLogger.Infof("Signature is not ok, mine:%v, get:%v", sign, remoteSign)
|
||||
return &CallbackResponse{Message: platformapi.ErrStrCallbackSignatureIsWrong}
|
||||
@@ -57,13 +57,13 @@ func (e *API) CheckCallbackValidation(mapData map[string]interface{}) (callbackR
|
||||
return nil
|
||||
}
|
||||
|
||||
func (e *API) GetCallbackMsg(data []byte) (msg *CallbackMsg, callbackResponse *CallbackResponse) {
|
||||
func (a *API) GetCallbackMsg(data []byte) (msg *CallbackMsg, callbackResponse *CallbackResponse) {
|
||||
msg = new(CallbackMsg)
|
||||
if callbackResponse = e.unmarshalData(data, msg); callbackResponse != nil {
|
||||
if callbackResponse = a.unmarshalData(data, msg); callbackResponse != nil {
|
||||
return nil, callbackResponse
|
||||
}
|
||||
|
||||
mapData := structs.Map(msg)
|
||||
callbackResponse = e.CheckCallbackValidation(mapData)
|
||||
callbackResponse = a.CheckCallbackValidation(mapData)
|
||||
return msg, callbackResponse
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user