예제 #1
0
        /// <summary>
        ///  生成图文消息
        /// </summary>
        /// <param name="model">The model.</param>
        /// <param name="articles">The content.</param>
        /// Author  : 俞立钢
        /// Company : 绍兴标点电子技术有限公司
        /// Created : 2014-10-24 09:57:37
        private static void ProduceNews(Dictionary <string, string> model, List <ArticlesModel> articles)
        {
            SendPicTxt text = new SendPicTxt();

            text.ToUserName   = model.ReadKey(PublicField.FromUserName);
            text.FromUserName = model.ReadKey(PublicField.ToUserName);
            text.CreateTime   = int.Parse(model.ReadKey(PublicField.CreateTime));
            text.MsgType      = "news";
            text.ArticleCount = articles.Count.ToString("D");
        }
예제 #2
0
 /// <summary>
 ///  回复的图文消息的函数
 /// </summary>
 /// <param name="model">The model.</param>
 /// <param name="articles">The content.</param>
 /// Author  : 俞立钢
 /// Company : 绍兴标点电子技术有限公司
 /// Created : 2014-10-24 09:57:37
 private static void ProduceNews(Dictionary<string, string> model, List<ArticlesModel> articles)
 {
     SendPicTxt news = new SendPicTxt();
     news.ToUserName = model.ReadKey(PublicField.FromUserName);
     news.FromUserName = model.ReadKey(PublicField.ToUserName);
     news.CreateTime = int.Parse(model.ReadKey(PublicField.CreateTime));
     news.MsgType = "news";
     news.ArticleCount = articles.Count.ToString("D");
     news.Articles = articles;
     OperateXml.ResponseEnd(Templete.SendNews(news));
 }
예제 #3
0
        /// <summary>
        ///  回复图文信息
        /// </summary>
        /// <param name="model">The model.</param>
        /// Author  : 俞立钢
        /// Company : 绍兴标点电子技术有限公司
        /// Created : 2014-10-10 11:19:47
        public static string SendNews(SendPicTxt model)
        {
            string item = "";

            foreach (ArticlesModel articles in model.Articles)
            {
                item += string.Format(@"
                                    <item>
                                    <Title><![CDATA[{0}]]></Title>
                                    <Description><![CDATA[{1}]]></Description>
                                    <PicUrl><![CDATA[{2}]]></PicUrl>
                                    <Url><![CDATA[{3}]]></Url>
                                    </item>", articles.Title, articles.Description, articles.PicUrl, articles.Url);
            }
            return(string.Format(@"<xml>
                                    <ToUserName><![CDATA[{0}]]></ToUserName>
                                    <FromUserName><![CDATA[{1}]]></FromUserName>
                                    <CreateTime>{2}</CreateTime>
                                    <MsgType><![CDATA[{3}]]></MsgType>
                                    <ArticleCount>{4}</ArticleCount>
                                    <Articles>{5}</Articles>
                                   </xml> ", model.ToUserName, model.FromUserName, model.CreateTime, model.MsgType, model.ArticleCount, item));
        }