XmlDocument requestDocXml = new XmlDocument();
requestDocXml.LoadXml(sEchoStr);
XmlElement rootElement = requestDocXml.DocumentElement;
WxXmlModel WxXmlModel = new WxXmlModel();
WxXmlModel.ToUserName = rootElement.SelectSingleNode(“ToUserName”).InnerText;
WxXmlModel.FromUserName = rootElement.SelectSingleNode(“FromUserName”).InnerText;
WxXmlModel.CreateTime = rootElement.SelectSingleNode(“CreateTime”).InnerText;
WxXmlModel.MsgType = rootElement.SelectSingleNode(“MsgType”).InnerText;
WxXmlModel.AgentID = rootElement.SelectSingleNode(“AgentID”).InnerText;
WxXmlModel.CompanyId = companyid;
switch (WxXmlModel.MsgType)
{
case “text”😕/文本
WxXmlModel.Content = rootElement.SelectSingleNode(“Content”).InnerText;
break;
case “image”😕/图片
WxXmlModel.PicUrl = rootElement.SelectSingleNode(“PicUrl”).InnerText;
break;
case “event”😕/事件
WxXmlModel.Event = rootElement.SelectSingleNode(“Event”).InnerText;
if (WxXmlModel.Event == “click”)//菜单点击
{
WxXmlModel.EventKey = rootElement.SelectSingleNode(“EventKey”).InnerText;
SH.WebApp.WeChatHelper.Report.sendMsg(WxXmlModel);
}
break;
default:
break;
}
string