1
0
mirror of https://github.com/silenceper/wechat.git synced 2026-02-08 06:32:27 +08:00

oauth2,jssdk

This commit is contained in:
wenzl
2016-09-15 01:27:28 +08:00
parent d9075933c1
commit a89065d952
21 changed files with 913 additions and 43 deletions

View File

@@ -6,6 +6,7 @@ import (
"fmt"
"io/ioutil"
"reflect"
"runtime/debug"
"strconv"
"strings"
@@ -57,8 +58,10 @@ func (srv *Server) Serve() error {
return err
}
srv.buildResponse(response)
return nil
//debug
//fmt.Println("request msg = ", string(srv.requestRawXMLMsg))
return srv.buildResponse(response)
}
//Validate 校验请求是否合法
@@ -155,7 +158,7 @@ func (srv *Server) SetMessageHandler(handler func(message.MixMessage) *message.R
func (srv *Server) buildResponse(reply *message.Reply) (err error) {
defer func() {
if e := recover(); e != nil {
err = fmt.Errorf("panic error: %v", err)
err = fmt.Errorf("panic error: %v\n%s", e, debug.Stack())
}
}()
if reply == nil {
@@ -223,6 +226,8 @@ func (srv *Server) Send() (err error) {
Nonce: srv.nonce,
}
}
srv.XML(replyMsg)
if replyMsg != nil {
srv.XML(replyMsg)
}
return
}