- set ELMCallbackMsg's fields structs attr to avoid Upper case name when calling structs.Map.
This commit is contained in:
@@ -22,14 +22,14 @@ type ELMCallbackResponse struct {
|
||||
}
|
||||
|
||||
type ELMCallbackMsg struct {
|
||||
AppId int `json:"appId"`
|
||||
RequestId string `json:"requestId"`
|
||||
Type int `json:"type"`
|
||||
Message string `json:"message"`
|
||||
ShopId int `json:"shopId"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
UserId int64 `json:"userId"`
|
||||
Signature string `json:"signature"`
|
||||
AppId int `json:"appId" structs:"appId"`
|
||||
RequestId string `json:"requestId" structs:"requestId"`
|
||||
Type int `json:"type" structs:"type"`
|
||||
Message string `json:"message" structs:"message"`
|
||||
ShopId int `json:"shopId" structs:"shopId"`
|
||||
Timestamp int64 `json:"timestamp" structs:"timestamp"`
|
||||
UserId int64 `json:"userId" structs:"userId"`
|
||||
Signature string `json:"signature" structs:"signature"`
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -48,8 +48,8 @@ func (e *ELMAPI) unmarshalData(data []byte, msg interface{}) (callbackResponse *
|
||||
|
||||
func (e *ELMAPI) CheckRequestValidation(mapData map[string]interface{}) (callbackResponse *ELMCallbackResponse) {
|
||||
sign := e.signParamsMap(mapData, "")
|
||||
if sign != mapData[signKey].(string) {
|
||||
e.sugarLogger.Infof("Signature is not ok, mine:%v, get:%v", sign, mapData[signKey].(string))
|
||||
if remoteSign, ok := mapData[signKey].(string); ok && sign != remoteSign {
|
||||
e.sugarLogger.Infof("Signature is not ok, mine:%v, get:%v", sign, remoteSign)
|
||||
return &ELMCallbackResponse{Message: "signature is invalid"}
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user