| m := in.body.(PicMsg) | m := in.body.(PicMsg) | ||||
| str = buildPicMsg(openID, m.MediaId) | str = buildPicMsg(openID, m.MediaId) | ||||
| in.replyXML(str) | in.replyXML(str) | ||||
| procEchoRecordMsg(ss, "图片:..") | |||||
| case VoiceMsg: | case VoiceMsg: | ||||
| m := in.body.(VoiceMsg) | m := in.body.(VoiceMsg) | ||||
| str = buildVoiceMsg(openID, m.MediaId) | str = buildVoiceMsg(openID, m.MediaId) | ||||
| m := in.body.(VideoMsg) | m := in.body.(VideoMsg) | ||||
| str = buildVideoMsg(openID, "e2iNEiSxCX5TV1WbFd0TQMn5lilY3bylh1--lDBwi7I", "航拍春日哈工大", m.MediaId) | str = buildVideoMsg(openID, "e2iNEiSxCX5TV1WbFd0TQMn5lilY3bylh1--lDBwi7I", "航拍春日哈工大", m.MediaId) | ||||
| in.replyXML(str) | in.replyXML(str) | ||||
| procEchoRecordMsg(ss, "视频:..") | |||||
| case ShortVideoMsg: | case ShortVideoMsg: | ||||
| m := in.body.(ShortVideoMsg) | m := in.body.(ShortVideoMsg) | ||||
| str = buildVideoMsg(openID, "e2iNEiSxCX5TV1WbFd0TQMn5lilY3bylh1--lDBwi7I", "航拍春日哈工大", m.MediaId) | str = buildVideoMsg(openID, "e2iNEiSxCX5TV1WbFd0TQMn5lilY3bylh1--lDBwi7I", "航拍春日哈工大", m.MediaId) | ||||
| in.replyXML(str) | in.replyXML(str) | ||||
| procEchoRecordMsg(ss, "小视频:..") | |||||
| case LocationMsg: | case LocationMsg: | ||||
| m := in.body.(LocationMsg) | m := in.body.(LocationMsg) | ||||
| mid := location2MediaID(m.Location_X, m.Location_Y) | mid := location2MediaID(m.Location_X, m.Location_Y) | ||||
| in.replyXML(str) | in.replyXML(str) | ||||
| url := location2URL(m.Location_X, m.Location_Y) | url := location2URL(m.Location_X, m.Location_Y) | ||||
| kfSendTxt(openID, url+"\n"+fmt.Sprintf("long=%f, lat=%f, scale=%d", m.Location_X, m.Location_Y, m.Scale)) | kfSendTxt(openID, url+"\n"+fmt.Sprintf("long=%f, lat=%f, scale=%d", m.Location_X, m.Location_Y, m.Scale)) | ||||
| procEchoRecordMsg(ss, "坐标:..") | |||||
| case LinkMsg: | case LinkMsg: | ||||
| m := in.body.(LinkMsg) | m := in.body.(LinkMsg) | ||||
| str, _ = BuildTextMsg(openID, m.Url) | str, _ = BuildTextMsg(openID, m.Url) | ||||
| in.replyXML(str) | in.replyXML(str) | ||||
| kfSendTxt(openID, m.Title+m.Description) | kfSendTxt(openID, m.Title+m.Description) | ||||
| procEchoRecordMsg(ss, "链接:"+m.Title) | |||||
| case EventMsg: | case EventMsg: | ||||
| echoEvents(in) | |||||
| echoEvents(ss, in) | |||||
| default: | default: | ||||
| str, err = BuildTextMsg(openID, "text message") | str, err = BuildTextMsg(openID, "text message") | ||||
| } | } | ||||
| return | return | ||||
| } | } | ||||
| func echoEvents(in InWechatMsg) { | |||||
| func echoEvents(ss *openIDSessionData, in InWechatMsg) { | |||||
| openID := in.header.FromUserName | openID := in.header.FromUserName | ||||
| str := "" | str := "" | ||||
| m := in.body.(EventMsg) | m := in.body.(EventMsg) | ||||
| log.Println("Event = " + m.Event) | |||||
| //log.Println("Event = " + m.Event) | |||||
| procEchoRecordMsg(ss, "事件:"+m.Event) | |||||
| switch m.Event { | switch m.Event { | ||||
| case "LOCATION": | case "LOCATION": | ||||
| mid := location2MediaID(m.Latitude, m.Longitude) | mid := location2MediaID(m.Latitude, m.Longitude) |