Selaa lähdekoodia

using InWechagMsg member function.

master
Patrick Peng Sun 8 vuotta sitten
vanhempi
commit
a2af88883d
1 muutettua tiedostoa jossa 2 lisäystä ja 2 poistoa
  1. +2
    -2
      server.go

+ 2
- 2
server.go Näytä tiedosto

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




//read instant response //read instant response
reply = <-in.instantResponse reply = <-in.instantResponse
close(in.instantResponse)
in.destroy()
//uncomment the followin two lines to enable echo test //uncomment the followin two lines to enable echo test
// state, _ := echoCommand(in.header.FromUserName, in) // state, _ := echoCommand(in.header.FromUserName, in)
// reply = state.response // reply = state.response
} }
valid = true valid = true
fmt.Printf("decrypt as: %s\n", d) fmt.Printf("decrypt as: %s\n", d)
result.init()
result.header = ReadCommonHeader(d) result.header = ReadCommonHeader(d)
switch result.header.MsgType { switch result.header.MsgType {
case "text": case "text":

Loading…
Peruuta
Tallenna