Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

40 lines
855B

  1. package main
  2. import "net/http"
  3. //
  4. //InWechatMsg what we received currently from wechat
  5. type InWechatMsg struct {
  6. header CommonHeader
  7. body interface{} //dynamic type
  8. req *http.Request
  9. instantResponse chan string //instance reply channel
  10. }
  11. func (m *InWechatMsg) init() {
  12. m.instantResponse = make(chan string)
  13. }
  14. func (m *InWechatMsg) destroy() {
  15. close(m.instantResponse)
  16. }
  17. func (m *InWechatMsg) replyXML(xml string) {
  18. m.instantResponse <- xml
  19. }
  20. func (m *InWechatMsg) replyText(s string) {
  21. str, _ := BuildTextMsg(m.header.FromUserName, s)
  22. m.instantResponse <- str
  23. }
  24. func (m *InWechatMsg) transfer2KF() {
  25. str, _ := BuildKFTransferAnyOneMsg(m.header.FromUserName)
  26. m.replyXML(str)
  27. }
  28. func (m *InWechatMsg) transfer2SpecificKF(kf string) {
  29. str := buildKfForwardMsg(m.header.FromUserName, kf)
  30. m.replyXML(str)
  31. }