Procházet zdrojové kódy

using InWechagMsg member function.

master
Patrick Peng Sun před 8 roky
rodič
revize
a2af88883d
1 změnil soubory, kde provedl 2 přidání a 2 odebrání
  1. +2
    -2
      server.go

+ 2
- 2
server.go Zobrazit soubor

@@ -58,7 +58,6 @@ func answerInitialAuth(w http.ResponseWriter, r *http.Request) {
//answerWechatPost distribute PostRequest according to xml body info
func answerWechatPost(w http.ResponseWriter, r *http.Request) {
in, valid := readWechatInput(r)
in.instantResponse = make(chan string)
reply := "" //nothing
w.Header().Set("Content-Type", "text/xml; charset=utf-8")

@@ -71,7 +70,7 @@ func answerWechatPost(w http.ResponseWriter, r *http.Request) {

//read instant response
reply = <-in.instantResponse
close(in.instantResponse)
in.destroy()
//uncomment the followin two lines to enable echo test
// state, _ := echoCommand(in.header.FromUserName, in)
// reply = state.response
@@ -93,6 +92,7 @@ func readWechatInput(r *http.Request) (result InWechatMsg, valid bool) {
}
valid = true
fmt.Printf("decrypt as: %s\n", d)
result.init()
result.header = ReadCommonHeader(d)
switch result.header.MsgType {
case "text":

Načítá se…
Zrušit
Uložit