imv2
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package mtwmapi
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
@@ -154,19 +155,30 @@ func (a *API) GetIMCallbackMsg(request *http.Request) (msg *ImCallbackMsg, callb
|
||||
var (
|
||||
err = request.ParseForm()
|
||||
pushContent PushContentReq
|
||||
tData string
|
||||
)
|
||||
msg = &ImCallbackMsg{}
|
||||
msg.FormData = make(url.Values)
|
||||
if err == nil {
|
||||
data := utils.URLValues2Map(request.Form)
|
||||
if dataSign, ok := data[signKey]; ok {
|
||||
for k, v := range data {
|
||||
if k == "push_content" {
|
||||
//tData, _ = json.Marshal(v)
|
||||
tData = v.(string)
|
||||
continue
|
||||
}
|
||||
msg.FormData.Set(k, v.(string))
|
||||
}
|
||||
msg.Timestamp = utils.Str2Int(msg.FormData.Get("timestamp"))
|
||||
msg.Sig = dataSign.(string)
|
||||
msg.AppID = msg.FormData.Get("app_id")
|
||||
if err = utils.Map2StructByJson(data, pushContent, true); err == nil {
|
||||
if err = json.Unmarshal([]byte(tData), &pushContent); err == nil {
|
||||
msg.PushContent = pushContent
|
||||
}
|
||||
//if err = utils.Map2StructByJson(tData, &pushContent, true); err == nil {
|
||||
// msg.PushContent = pushContent
|
||||
//}
|
||||
} else {
|
||||
callbackResponse = SuccessResponse
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user