index.go 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  1. package index
  2. import (
  3. "encoding/json"
  4. "fmt"
  5. "github.com/gin-gonic/gin"
  6. "github.com/gin-gonic/gin/binding"
  7. "github.com/sbabiv/xml2map"
  8. "eta/eta_menu_sync/controller/resp"
  9. "eta/eta_menu_sync/global"
  10. "eta/eta_menu_sync/models"
  11. "eta/eta_menu_sync/services"
  12. "eta/eta_menu_sync/services/alarm_msg"
  13. "eta/eta_menu_sync/utils"
  14. "strconv"
  15. "strings"
  16. "time"
  17. )
  18. type IndexController struct {
  19. }
  20. func (s *IndexController) ServerCheck(c *gin.Context) {
  21. fmt.Println(c.Request.Body)
  22. resp.OkData("检测成功", 1, c)
  23. return
  24. }
  25. func (s *IndexController) Listen(c *gin.Context) {
  26. //strByte, err := c.GetRawData()
  27. //if err != nil {
  28. // fmt.Println("err:", err)
  29. //}
  30. //fmt.Println(string(strByte))
  31. //return
  32. var req EventReq
  33. if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
  34. fmt.Println("bind err:", err)
  35. resp.Fail("参数有误", c)
  36. return
  37. }
  38. jsonMap := make(map[string]interface{})
  39. if err := c.ShouldBindBodyWith(&jsonMap, binding.JSON); err == nil {
  40. //jsonStr, _ := json.Marshal(jsonMap)
  41. //global.LOG.Info("请求入参:", string(jsonStr))
  42. }
  43. //global.CONFIG.Serve.ListenWxId
  44. var err error
  45. defer func() {
  46. if err != nil {
  47. go alarm_msg.SendAlarmMsg(utils.APPNAME+"监听微信消息失败:"+time.Now().Format("2006-01-02 15:04:05")+";Err:"+err.Error(), 3, ``)
  48. }
  49. }()
  50. if req.Data.Type == "D0003" {
  51. fromTypeInter, ok := req.Data.Data["fromType"]
  52. if !ok {
  53. resp.Fail("错误的来源", c)
  54. return
  55. }
  56. // 消息来源,1:私聊,2:群聊,3:公众号
  57. fromType := fromTypeInter.(float64)
  58. if fromType != 1 && fromType != 2 {
  59. resp.Ok("不做处理", c)
  60. return
  61. }
  62. msgTypeInter, ok := req.Data.Data["msgType"]
  63. if !ok {
  64. resp.Fail("错误的消息", c)
  65. return
  66. }
  67. var fromWxid, finalFromWechatId, jumpPath, msg string
  68. {
  69. fromWxidInter, ok := req.Data.Data["fromWxid"]
  70. if !ok {
  71. resp.OkData("找不到来源id", 1, c)
  72. return
  73. }
  74. fromWxid = fromWxidInter.(string) //私聊时为用户id,群聊是为群id,公众号则是公众号id
  75. }
  76. //群内发言人的微信id
  77. {
  78. if finalFromWxidInter, ok := req.Data.Data["finalFromWxid"]; ok {
  79. finalFromWechatId = finalFromWxidInter.(string) //群内发言人的微信id
  80. }
  81. }
  82. if fromWxid != global.CONFIG.Serve.ListenWxId {
  83. resp.OkData("不监听该来源信息", 1, c)
  84. return
  85. }
  86. msgType := msgTypeInter.(float64)
  87. switch msgType {
  88. case 49: //分享链接或者附件(通过xml发送)
  89. //return
  90. // 来源用户
  91. msg = req.Data.Data["msg"].(string)
  92. wxappInfo := getWxappInfo(msg)
  93. if wxappInfo.Appid != `` && wxappInfo.PagePath != `` {
  94. jumpPath = wxappInfo.Appid + `/` + wxappInfo.PagePath
  95. }
  96. tmpMsg, tmpErr := strconv.Unquote(strings.Replace(strconv.Quote(msg), `\\u`, `\u`, -1))
  97. if tmpErr != nil {
  98. err = tmpErr
  99. fmt.Println("err:", tmpErr)
  100. return
  101. }
  102. msg = tmpMsg
  103. //msg = strings.Replace(msg, fromWxid, "wxid_pslc6fxtftcb22", -1)
  104. //sendErr = sendXml(msg)
  105. //fmt.Println(msg)
  106. }
  107. jsonStr, _ := json.Marshal(jsonMap)
  108. item := &models.WechatListenMsgRecord{
  109. //WechatMsgId: 0,
  110. Content: string(jsonStr),
  111. FromWechatId: fromWxid,
  112. FinalFromWechatId: finalFromWechatId,
  113. WechatId: req.Wxid,
  114. MsgType: int(msgType),
  115. Msg: msg,
  116. JumpPath: jumpPath,
  117. CreateTime: time.Now(),
  118. }
  119. err = item.Create()
  120. if err != nil {
  121. global.LOG.Info("添加监听消息失败")
  122. }
  123. }
  124. resp.OkData("回调成功", 1, c)
  125. return
  126. }
  127. func (s *IndexController) ListenBak(c *gin.Context) {
  128. //strByte, err := c.GetRawData()
  129. //if err != nil {
  130. // fmt.Println("err:", err)
  131. //}
  132. //fmt.Println(string(strByte))
  133. //return
  134. var req EventReq
  135. if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
  136. fmt.Println("bind err:", err)
  137. resp.Fail("参数有误", c)
  138. return
  139. }
  140. jsonMap := make(map[string]interface{})
  141. if err := c.ShouldBindBodyWith(&jsonMap, binding.JSON); err == nil {
  142. jsonStr, _ := json.Marshal(jsonMap)
  143. global.LOG.Info("请求入参:", string(jsonStr))
  144. }
  145. if req.Data.Type == "D0003" {
  146. msgTypeInter, ok := req.Data.Data["msgType"]
  147. if !ok {
  148. resp.Fail("错误的消息", c)
  149. return
  150. }
  151. msgType := msgTypeInter.(float64)
  152. var sendErr error
  153. switch msgType {
  154. case 1: //文本
  155. sendErr = sendText(req.Data.Data["msg"].(string))
  156. case 3: //图片
  157. case 49: //分享链接或者附件(通过xml发送
  158. //return
  159. // 来源用户
  160. fromWxidInter, ok := req.Data.Data["fromWxid"]
  161. if !ok {
  162. resp.OkData("找不到来源id", 1, c)
  163. return
  164. }
  165. fromWxid := fromWxidInter.(string)
  166. msg := req.Data.Data["msg"].(string)
  167. msg, err := strconv.Unquote(strings.Replace(strconv.Quote(string(msg)), `\\u`, `\u`, -1))
  168. if err != nil {
  169. fmt.Println("err:", err)
  170. return
  171. }
  172. msg = strings.Replace(msg, fromWxid, "wxid_pslc6fxtftcb22", -1)
  173. sendErr = sendXml(msg)
  174. }
  175. if sendErr != nil {
  176. fmt.Println("发送失败,err:", sendErr.Error())
  177. }
  178. }
  179. resp.OkData("回调成功", 1, c)
  180. return
  181. }
  182. type EventReq struct {
  183. Event int `json:"event"`
  184. Wxid string `json:"wxid"`
  185. Data EventDataReq `json:"data"`
  186. }
  187. type EventDataReq struct {
  188. Type string `json:"type"`
  189. Des string `json:"des"`
  190. Timestamp string `json:"timestamp"`
  191. Wxid string `json:"wxid"`
  192. Port int `json:"port"`
  193. Pid int `json:"pid"`
  194. Flag string `json:"flag"`
  195. Data map[string]interface{} `json:"data"`
  196. }
  197. type TextDataReq struct {
  198. TimeStamp string `json:"timeStamp"`
  199. FromType int `json:"fromType"`
  200. MsgType int `json:"msgType"`
  201. MsgSource int `json:"msgSource"`
  202. FromWxid string `json:"fromWxid"`
  203. FinalFromWxid string `json:"finalFromWxid"`
  204. AtWxidList []interface{} `json:"atWxidList"`
  205. Silence int `json:"silence"`
  206. Membercount int `json:"membercount"`
  207. Signature string `json:"signature"`
  208. Msg string `json:"msg"`
  209. MsgBase64 string `json:"msgBase64"`
  210. }
  211. func sendText(msg string) (err error) {
  212. //wxRoomId := `wxid_5pf21jz6tbea22`
  213. wxRoomId := `wxid_pslc6fxtftcb22`
  214. toWxId := `wxid_vgnigr1qaizm22`
  215. result, _, err := services.SendText("192.168.77.14", wxRoomId, toWxId, msg)
  216. if err != nil {
  217. fmt.Println("err:", err)
  218. return
  219. }
  220. fmt.Println(result)
  221. return
  222. }
  223. func sendXml(msg string) (err error) {
  224. //fmt.Println(msg)
  225. //return
  226. //wxRoomId := `wxid_5pf21jz6tbea22`
  227. fmt.Println("进来了")
  228. wxRoomId := `wxid_pslc6fxtftcb22`
  229. toWxId := `wxid_vgnigr1qaizm22`
  230. _, _, err = services.SendXml("192.168.77.14", wxRoomId, toWxId, msg)
  231. if err != nil {
  232. fmt.Println("err:", err)
  233. return
  234. }
  235. //fmt.Println(result)
  236. return
  237. }
  238. type WxappInfo struct {
  239. PagePath string `description:"小程序跳转路径"`
  240. UserName string `description:"小程序唯一标识"`
  241. Appid string `description:"appid"`
  242. }
  243. func getWxappInfo(msg string) (wxappInfo WxappInfo) {
  244. decoder := xml2map.NewDecoder(strings.NewReader(msg))
  245. result, err := decoder.Decode()
  246. if err != nil {
  247. fmt.Println("err:", err)
  248. return
  249. }
  250. msgMapInterface, ok := result["msg"]
  251. if !ok {
  252. return
  253. }
  254. msgMap := msgMapInterface.(map[string]interface{})
  255. appMsgMapInterface, ok := msgMap["appmsg"]
  256. if !ok {
  257. return
  258. }
  259. appMsgMap := appMsgMapInterface.(map[string]interface{})
  260. // 小程序的一些信息
  261. weappinfoMapInterface, ok := appMsgMap["weappinfo"]
  262. if !ok {
  263. return
  264. }
  265. weappinfoMap := weappinfoMapInterface.(map[string]interface{})
  266. // <pagepath>pages/roadShow/video/list.html?videoId=254</pagepath>
  267. // <username>gh_75abb562a946@app</username>
  268. // <appid>wxb059c872d79b9967</appid>
  269. // <version>88</version>
  270. // <type>2</type>
  271. // <weappiconurl>http://wx.qlogo.cn/mmhead/Q3auHgzwzM6Q4hiceHmmbCl9XFAicAevBiaywMXNZXNicFHsUqibAMybcUQ/96</weappiconurl>
  272. // <appservicetype>0</appservicetype>
  273. // <shareId>1_wxb059c872d79b9967_5ee3244b8e0678fd6d8bab0b4976ea15_1679996983_1</shareId>
  274. // 小程序跳转地址
  275. tmpInterface, ok := weappinfoMap["pagepath"]
  276. if !ok {
  277. return
  278. }
  279. wxappInfo.PagePath = tmpInterface.(string)
  280. // 移除跳转路径中的.html字符
  281. wxappInfo.PagePath = strings.Replace(wxappInfo.PagePath, ".html?", "?", 1)
  282. // 小程序appid
  283. tmpInterface, ok = weappinfoMap["appid"]
  284. if !ok {
  285. return
  286. }
  287. wxappInfo.Appid = tmpInterface.(string)
  288. return
  289. }
  290. // func init() {
  291. // dataStr := `{"type":"Q0001","data":{"msg":"<?xml version=\"1.0\"?>\r\n<msg>\r\n\t<appmsg appid=\"\" sdkver=\"0\">\r\n\t\t<title>欧美市场隔夜复盘:德银和更多银行业风波的暴风眼</title>\r\n\t\t<des />\r\n\t\t<username />\r\n\t\t<action>view</action>\r\n\t\t<type>33</type>\r\n\t\t<showtype>0</showtype>\r\n\t\t<content />\r\n\t\t<url>https://mp.weixin.qq.com/mp/waerrpage?appid=wxb059c872d79b9967&amp;type=upgrade&amp;upgradetype=3#wechat_redirect</url>\r\n\t\t<lowurl />\r\n\t\t<forwardflag>0</forwardflag>\r\n\t\t<dataurl />\r\n\t\t<lowdataurl />\r\n\t\t<contentattr>0</contentattr>\r\n\t\t<streamvideo>\r\n\t\t\t<streamvideourl />\r\n\t\t\t<streamvideototaltime>0</streamvideototaltime>\r\n\t\t\t<streamvideotitle />\r\n\t\t\t<streamvideowording />\r\n\t\t\t<streamvideoweburl />\r\n\t\t\t<streamvideothumburl />\r\n\t\t\t<streamvideoaduxinfo />\r\n\t\t\t<streamvideopublishid />\r\n\t\t</streamvideo>\r\n\t\t<canvasPageItem>\r\n\t\t\t<canvasPageXml><![CDATA[]]></canvasPageXml>\r\n\t\t</canvasPageItem>\r\n\t\t<appattach>\r\n\t\t\t<attachid />\r\n\t\t\t<cdnthumburl>3057020100044b30490201000204503cca9502032df73102043023dd3a020464225cee042463353633656535652d313936312d343832642d393833332d3633323862653135616338340204011408030201000405004c4f2900</cdnthumburl>\r\n\t\t\t<cdnthumbmd5>3b7a15b6611904ff756372c962c49fcd</cdnthumbmd5>\r\n\t\t\t<cdnthumblength>55698</cdnthumblength>\r\n\t\t\t<cdnthumbheight>576</cdnthumbheight>\r\n\t\t\t<cdnthumbwidth>720</cdnthumbwidth>\r\n\t\t\t<cdnthumbaeskey>0feaa7e810f7d0f09c6e58fd815faf49</cdnthumbaeskey>\r\n\t\t\t<aeskey>0feaa7e810f7d0f09c6e58fd815faf49</aeskey>\r\n\t\t\t<encryver>1</encryver>\r\n\t\t\t<fileext />\r\n\t\t\t<islargefilemsg>0</islargefilemsg>\r\n\t\t</appattach>\r\n\t\t<extinfo />\r\n\t\t<androidsource>3</androidsource>\r\n\t\t<sourceusername>gh_75abb562a946@app</sourceusername>\r\n\t\t<sourcedisplayname>弘则研究</sourcedisplayname>\r\n\t\t<commenturl />\r\n\t\t<thumburl />\r\n\t\t<mediatagname />\r\n\t\t<messageaction><![CDATA[]]></messageaction>\r\n\t\t<messageext><![CDATA[]]></messageext>\r\n\t\t<emoticongift>\r\n\t\t\t<packageflag>0</packageflag>\r\n\t\t\t<packageid />\r\n\t\t</emoticongift>\r\n\t\t<emoticonshared>\r\n\t\t\t<packageflag>0</packageflag>\r\n\t\t\t<packageid />\r\n\t\t</emoticonshared>\r\n\t\t<designershared>\r\n\t\t\t<designeruin>0</designeruin>\r\n\t\t\t<designername>null</designername>\r\n\t\t\t<designerrediretcturl>null</designerrediretcturl>\r\n\t\t</designershared>\r\n\t\t<emotionpageshared>\r\n\t\t\t<tid>0</tid>\r\n\t\t\t<title>null</title>\r\n\t\t\t<desc>null</desc>\r\n\t\t\t<iconUrl>null</iconUrl>\r\n\t\t\t<secondUrl />\r\n\t\t\t<pageType>0</pageType>\r\n\t\t\t<setKey>null</setKey>\r\n\t\t</emotionpageshared>\r\n\t\t<webviewshared>\r\n\t\t\t<shareUrlOriginal />\r\n\t\t\t<shareUrlOpen />\r\n\t\t\t<jsAppId />\r\n\t\t\t<publisherId />\r\n\t\t</webviewshared>\r\n\t\t<template_id />\r\n\t\t<md5>3b7a15b6611904ff756372c962c49fcd</md5>\r\n\t\t<websearch />\r\n\t\t<weappinfo>\r\n\t\t\t<pagepath><![CDATA[pages-voice/voiceDetail.html?voiceId=351]]></pagepath>\r\n\t\t\t<username>gh_75abb562a946@app</username>\r\n\t\t\t<appid>wxb059c872d79b9967</appid>\r\n\t\t\t<version>88</version>\r\n\t\t\t<type>2</type>\r\n\t\t\t<weappiconurl><![CDATA[http://mmbiz.qpic.cn/mmbiz_png/a4OiaGCTMP201pmKhL0sib1URsAVZyiazKs4Cw7g7pVAIXBvVtzS8aXA0aHoric91ret4iazkZIh1zKO0NicJksOKJGw/640?wx_fmt=png&wxfrom=200]]></weappiconurl>\r\n\t\t\t<weapppagethumbrawurl><![CDATA[https://hzstatic.hzinsights.com/static/images/yb/htm2img/D3EANBLgyuIVWZkGmVicu7KO3km4.jpg]]></weapppagethumbrawurl>\r\n\t\t\t<shareId><![CDATA[0_wxb059c872d79b9967_c29fb8d17937563630f66b3afba69df7_1679962340_0]]></shareId>\r\n\t\t\t<appservicetype>0</appservicetype>\r\n\t\t\t<secflagforsinglepagemode>0</secflagforsinglepagemode>\r\n\t\t\t<videopageinfo>\r\n\t\t\t\t<thumbwidth>720</thumbwidth>\r\n\t\t\t\t<thumbheight>576</thumbheight>\r\n\t\t\t\t<fromopensdk>0</fromopensdk>\r\n\t\t\t</videopageinfo>\r\n\t\t</weappinfo>\r\n\t\t<statextstr />\r\n\t\t<musicShareItem>\r\n\t\t\t<musicDuration>0</musicDuration>\r\n\t\t</musicShareItem>\r\n\t\t<finderLiveProductShare>\r\n\t\t\t<finderLiveID><![CDATA[]]></finderLiveID>\r\n\t\t\t<finderUsername><![CDATA[]]></finderUsername>\r\n\t\t\t<finderObjectID><![CDATA[]]></finderObjectID>\r\n\t\t\t<finderNonceID><![CDATA[]]></finderNonceID>\r\n\t\t\t<liveStatus><![CDATA[]]></liveStatus>\r\n\t\t\t<appId><![CDATA[]]></appId>\r\n\t\t\t<pagePath><![CDATA[]]></pagePath>\r\n\t\t\t<productId><![CDATA[]]></productId>\r\n\t\t\t<coverUrl><![CDATA[]]></coverUrl>\r\n\t\t\t<productTitle><![CDATA[]]></productTitle>\r\n\t\t\t<marketPrice><![CDATA[0]]></marketPrice>\r\n\t\t\t<sellingPrice><![CDATA[0]]></sellingPrice>\r\n\t\t\t<platformHeadImg><![CDATA[]]></platformHeadImg>\r\n\t\t\t<platformName><![CDATA[]]></platformName>\r\n\t\t\t<shopWindowId><![CDATA[]]></shopWindowId>\r\n\t\t\t<flashSalePrice><![CDATA[0]]></flashSalePrice>\r\n\t\t\t<flashSaleEndTime><![CDATA[0]]></flashSaleEndTime>\r\n\t\t\t<ecSource><![CDATA[]]></ecSource>\r\n\t\t\t<sellingPriceWording><![CDATA[]]></sellingPriceWording>\r\n\t\t\t<platformIconURL><![CDATA[]]></platformIconURL>\r\n\t\t\t<firstProductTagURL><![CDATA[]]></firstProductTagURL>\r\n\t\t\t<firstProductTagAspectRatioString><![CDATA[0.0]]></firstProductTagAspectRatioString>\r\n\t\t\t<secondProductTagURL><![CDATA[]]></secondProductTagURL>\r\n\t\t\t<secondProductTagAspectRatioString><![CDATA[0.0]]></secondProductTagAspectRatioString>\r\n\t\t\t<firstGuaranteeWording><![CDATA[]]></firstGuaranteeWording>\r\n\t\t\t<secondGuaranteeWording><![CDATA[]]></secondGuaranteeWording>\r\n\t\t\t<thirdGuaranteeWording><![CDATA[]]></thirdGuaranteeWording>\r\n\t\t\t<isPriceBeginShow>false</isPriceBeginShow>\r\n\t\t</finderLiveProductShare>\r\n\t\t<finderOrder>\r\n\t\t\t<appID><![CDATA[]]></appID>\r\n\t\t\t<orderID><![CDATA[]]></orderID>\r\n\t\t\t<path><![CDATA[]]></path>\r\n\t\t\t<priceWording><![CDATA[]]></priceWording>\r\n\t\t\t<stateWording><![CDATA[]]></stateWording>\r\n\t\t\t<productImageURL><![CDATA[]]></productImageURL>\r\n\t\t\t<products><![CDATA[]]></products>\r\n\t\t\t<productsCount><![CDATA[0]]></productsCount>\r\n\t\t</finderOrder>\r\n\t\t<finderShopWindowShare>\r\n\t\t\t<finderUsername><![CDATA[]]></finderUsername>\r\n\t\t\t<avatar><![CDATA[]]></avatar>\r\n\t\t\t<nickname><![CDATA[]]></nickname>\r\n\t\t\t<commodityInStockCount><![CDATA[]]></commodityInStockCount>\r\n\t\t\t<appId><![CDATA[]]></appId>\r\n\t\t\t<path><![CDATA[]]></path>\r\n\t\t\t<appUsername><![CDATA[]]></appUsername>\r\n\t\t\t<query><![CDATA[]]></query>\r\n\t\t\t<liteAppId><![CDATA[]]></liteAppId>\r\n\t\t\t<liteAppPath><![CDATA[]]></liteAppPath>\r\n\t\t\t<liteAppQuery><![CDATA[]]></liteAppQuery>\r\n\t\t</finderShopWindowShare>\r\n\t\t<findernamecard>\r\n\t\t\t<username />\r\n\t\t\t<avatar><![CDATA[]]></avatar>\r\n\t\t\t<nickname />\r\n\t\t\t<auth_job />\r\n\t\t\t<auth_icon>0</auth_icon>\r\n\t\t\t<auth_icon_url />\r\n\t\t\t<ecSource><![CDATA[]]></ecSource>\r\n\t\t</findernamecard>\r\n\t\t<finderGuarantee>\r\n\t\t\t<scene><![CDATA[0]]></scene>\r\n\t\t</finderGuarantee>\r\n\t\t<directshare>0</directshare>\r\n\t\t<gamecenter>\r\n\t\t\t<namecard>\r\n\t\t\t\t<iconUrl />\r\n\t\t\t\t<name />\r\n\t\t\t\t<desc />\r\n\t\t\t\t<tail />\r\n\t\t\t\t<jumpUrl />\r\n\t\t\t</namecard>\r\n\t\t</gamecenter>\r\n\t\t<patMsg>\r\n\t\t\t<chatUser />\r\n\t\t\t<records>\r\n\t\t\t\t<recordNum>0</recordNum>\r\n\t\t\t</records>\r\n\t\t</patMsg>\r\n\t\t<secretmsg>\r\n\t\t\t<issecretmsg>0</issecretmsg>\r\n\t\t</secretmsg>\r\n\t\t<referfromscene>0</referfromscene>\r\n\t\t<gameshare>\r\n\t\t\t<liteappext>\r\n\t\t\t\t<liteappbizdata />\r\n\t\t\t\t<liteapppriority>0</liteapppriority>\r\n\t\t\t</liteappext>\r\n\t\t\t<gameshareid />\r\n\t\t\t<sharedata />\r\n\t\t\t<isvideo>0</isvideo>\r\n\t\t\t<duration>0</duration>\r\n\t\t\t<isexposed>0</isexposed>\r\n\t\t\t<readtext />\r\n\t\t</gameshare>\r\n\t</appmsg>\r\n\t<fromusername>wxid_6895448954512</fromusername>\r\n\t<scene>0</scene>\r\n\t<appinfo>\r\n\t\t<version>1</version>\r\n\t\t<appname></appname>\r\n\t</appinfo>\r\n\t<commenturl></commenturl>\r\n</msg>\r\n","wxid":"wxid_vgnigr1qaizm22"}}`
  292. //
  293. // fmt.Println("进来了")
  294. // decoder := xml2map.NewDecoder(strings.NewReader(dataStr))
  295. // result, err := decoder.Decode()
  296. // if err != nil {
  297. // fmt.Println("err:", err)
  298. // return
  299. // }
  300. // fmt.Println(result)
  301. // }