private static string VoiceMsgHandleAsync(XmlDocument xmldoc) { string responseContent = "", reply = null; var ToUserName = xmldoc.SelectSingleNode("/xml/ToUserName"); var FromUserName = xmldoc.SelectSingleNode("/xml/FromUserName"); var Content = xmldoc.SelectSingleNode("/xml/Recognition"); if (Content != null) { //设置回复消息 reply = ChatRobotHelper.GetBotReply(HttpContext.Current.Server.UrlEncode(Content.InnerText)); if (reply == "error") { reply = Content.InnerText; } responseContent = string.Format(ReplyMessageType.Message_Text, FromUserName.InnerText, ToUserName.InnerText, DateTime.Now.Ticks, String.IsNullOrEmpty(reply) ? "Sorry,I can not follow you." : reply); } logger.Debug("接受的消息:" + Content.InnerText + "\r\n 发送的消息:" + reply); return(responseContent); }
private static string TextMsgHandle(XmlDocument xmldoc) { string responseContent = "", reply = ""; var ToUserName = xmldoc.SelectSingleNode("/xml/ToUserName"); var FromUserName = xmldoc.SelectSingleNode("/xml/FromUserName"); var Content = xmldoc.SelectSingleNode("/xml/Content"); if (Content != null) { //设置回复消息 reply = ChatRobotHelper.GetBotReply(HttpContext.Current.Server.UrlEncode(Content.InnerText)); if (reply == "error") { reply = Content.InnerText; } responseContent = string.Format(ReplyMessageType.Message_Text, FromUserName.InnerText, ToUserName.InnerText, DateTime.Now.Ticks, reply); } logger.Info("接受的消息:" + Content.InnerText + "\r\n 发送的消息:" + reply); return(responseContent); }