예제 #1
0
        /// <summary>
        /// 订阅后回复
        /// </summary>
        /// <param name="xmlDoc"></param>
        /// <returns></returns>
        public static string subscribeRes(XmlDocument xmlDoc)
        {
            string fromUser    = GetFromXML(xmlDoc, "FromUserName");
            string toUser      = GetFromXML(xmlDoc, "ToUserName");
            string Title       = "欢迎关注嘻嘻爸爸开发的公众号";
            string Description = "i love you my baby";
            string PicUrl      = "http://119.29.20.29/image/test.jpg";
            string Url         = "http://119.29.20.29/WebPage/index.html";
            string result      = WeiXinXML.ReArticle(fromUser, toUser, Title, Description, PicUrl, Url);

            return(result);
        }
예제 #2
0
        /// <summary>
        /// 订阅后回复
        /// </summary>
        /// <param name="xmlDoc"></param>
        /// <returns></returns>
        public static string subscribeRes(XmlDocument xmlDoc)
        {
            string fromUser    = GetFromXML(xmlDoc, "FromUserName");
            string toUser      = GetFromXML(xmlDoc, "ToUserName");
            string Title       = "欢迎关注我的公众号";
            string Description = "欢迎";
            //string PicUrl = "http://119.29.20.29/image/42.jpg";
            //string Url = "http://119.29.20.29/WebPage/index.html";

            string PicUrl = "http://rnnv9a.natappfree.cc/image/42.jpg";
            string Url    = "http://rnnv9a.natappfree.cc/WebPage/index.html";
            string result = WeiXinXML.ReArticle(fromUser, toUser, Title, Description, PicUrl, Url);

            return(result);
        }
예제 #3
0
 /// <summary>
 /// 获取消息的各个字段
 /// </summary>
 /// <param name="xmlDoc"></param>
 /// <param name="model"></param>
 /// <returns></returns>
 public void  GetMsgModel(XmlDocument xmlDoc)
 {
     wx.FromUserName = WeiXinXML.GetFromXML(xmlDoc, "FromUserName");
     wx.ToUserName   = WeiXinXML.GetFromXML(xmlDoc, "ToUserName");
     wx.MsgType      = WeiXinXML.GetFromXML(xmlDoc, "MsgType");
     wx.EventName    = WeiXinXML.GetFromXML(xmlDoc, "EventName");
     wx.Content      = WeiXinXML.GetFromXML(xmlDoc, "Content");
     wx.Recognition  = WeiXinXML.GetFromXML(xmlDoc, "Recognition");
     wx.MediaId      = WeiXinXML.GetFromXML(xmlDoc, "MediaId");
     wx.EventKey     = WeiXinXML.GetFromXML(xmlDoc, "EventKey");
     wx.Location_X   = WeiXinXML.GetFromXML(xmlDoc, "Location_X");
     wx.Location_Y   = WeiXinXML.GetFromXML(xmlDoc, "Location_Y");
     wx.Scale        = WeiXinXML.GetFromXML(xmlDoc, "Scale");
     wx.Label        = WeiXinXML.GetFromXML(xmlDoc, "Label");
     wx.Latitude     = WeiXinXML.GetFromXML(xmlDoc, "Latitude");
     wx.Longitude    = WeiXinXML.GetFromXML(xmlDoc, "Longitude");
     wx.Precision    = WeiXinXML.GetFromXML(xmlDoc, "Precision");
 }
예제 #4
0
        /// <summary>
        /// 给微信消息赋值
        /// </summary>
        /// <param name="root"></param>
        /// <param name="model"></param>
        /// <returns></returns>
        public wxmessage GetWxMessage(XmlDocument doc)
        {
            wxmessage wxModel = new wxmessage();

            if (!string.IsNullOrEmpty(WeiXinXML.GetFromXML(doc, "FromUserName")))
            {
                wxModel.FromUserName = WeiXinXML.GetFromXML(doc, "FromUserName");
            }
            else
            {
                wxModel.FromUserName = string.Empty;
            }
            if (!string.IsNullOrEmpty(WeiXinXML.GetFromXML(doc, "ToUserName")))
            {
                wxModel.ToUserName = WeiXinXML.GetFromXML(doc, "ToUserName");
            }
            else
            {
                wxModel.ToUserName = string.Empty;
            }
            wxModel.CreateTime = WeiXinXML.GetFromXML(doc, "CreateTime");
            if (!string.IsNullOrEmpty(WeiXinXML.GetFromXML(doc, "MsgType")))
            {
                wxModel.MsgType = WeiXinXML.GetFromXML(doc, "MsgType");
            }
            else
            {
                wxModel.MsgType = string.Empty;
            }
            if (!string.IsNullOrEmpty(WeiXinXML.GetFromXML(doc, "Event")))
            {
                wxModel.EventName = WeiXinXML.GetFromXML(doc, "Event");
            }
            else
            {
                wxModel.EventName = string.Empty;
            }
            if (!string.IsNullOrEmpty(WeiXinXML.GetFromXML(doc, "Content")))
            {
                wxModel.Content = WeiXinXML.GetFromXML(doc, "Content");
            }
            else
            {
                wxModel.Content = string.Empty;
            }
            if (!string.IsNullOrEmpty(WeiXinXML.GetFromXML(doc, "Recognition")))
            {
                wxModel.Recognition = WeiXinXML.GetFromXML(doc, "Recognition");
            }
            else
            {
                wxModel.Recognition = string.Empty;
            }
            if (!string.IsNullOrEmpty(WeiXinXML.GetFromXML(doc, "MediaId")))
            {
                wxModel.MediaId = WeiXinXML.GetFromXML(doc, "MediaId");
            }
            else
            {
                wxModel.MediaId = string.Empty;
            }
            if (!string.IsNullOrEmpty(WeiXinXML.GetFromXML(doc, "EventKey")))
            {
                wxModel.EventKey = WeiXinXML.GetFromXML(doc, "EventKey");
            }
            else
            {
                wxModel.EventKey = string.Empty;
            }
            if (!string.IsNullOrEmpty(WeiXinXML.GetFromXML(doc, "Location_X")))
            {
                wxModel.Location_X = WeiXinXML.GetFromXML(doc, "Location_X");
            }
            else
            {
                wxModel.Location_X = string.Empty;
            }
            if (!string.IsNullOrEmpty(WeiXinXML.GetFromXML(doc, "Location_Y")))
            {
                wxModel.Location_Y = WeiXinXML.GetFromXML(doc, "Location_Y");
            }
            else
            {
                wxModel.Location_Y = string.Empty;
            }
            if (!string.IsNullOrEmpty(WeiXinXML.GetFromXML(doc, "Scale")))
            {
                wxModel.Scale = WeiXinXML.GetFromXML(doc, "Scale");
            }
            else
            {
                wxModel.Scale = string.Empty;
            }
            if (!string.IsNullOrEmpty(WeiXinXML.GetFromXML(doc, "Label")))
            {
                wxModel.Label = WeiXinXML.GetFromXML(doc, "Label");
            }
            else
            {
                wxModel.Label = string.Empty;
            }
            if (!string.IsNullOrEmpty(WeiXinXML.GetFromXML(doc, "Latitude")))
            {
                wxModel.Latitude = WeiXinXML.GetFromXML(doc, "Latitude");
            }
            else
            {
                wxModel.Latitude = string.Empty;
            }
            if (!string.IsNullOrEmpty(WeiXinXML.GetFromXML(doc, "Longitude")))
            {
                wxModel.Longitude = WeiXinXML.GetFromXML(doc, "Longitude");
            }
            else
            {
                wxModel.Longitude = string.Empty;
            }
            if (!string.IsNullOrEmpty(WeiXinXML.GetFromXML(doc, "Precision")))
            {
                wxModel.Precision = WeiXinXML.GetFromXML(doc, "Precision");
            }
            else
            {
                wxModel.Precision = string.Empty;
            }
            return(wxModel);
        }