Beispiel #1
0
        /// <summary>
        /// 回复消息(音乐)
        /// </summary>
        public void ResMusic(EnterParam param, ResMusic music)
        {
            var resxml = new StringBuilder();

            resxml.AppendFormat("<xml><ToUserName><![CDATA[{0}]]></ToUserName>", FromUserName);
            resxml.AppendFormat("<FromUserName><![CDATA[{0}]]></FromUserName>", ToUserName);
            resxml.AppendFormat("<CreateTime>{0}</CreateTime>", Utils.ConvertDateTimeInt(DateTime.Now));
            resxml.Append("<MsgType><![CDATA[music]]></MsgType>");
            resxml.AppendFormat("<Music><MusicUrl><![CDATA[{0}]]></MusicUrl>", music.MusicUrl);
            resxml.AppendFormat("<Title><![CDATA[{0}]]></Title>", music.Title);
            resxml.AppendFormat("<HQMusicUrl><![CDATA[{0}]]></HQMusicUrl>", music.HQMusicUrl);
            resxml.AppendFormat("<ThumbMediaId><![CDATA[{0}]]></ThumbMediaId>", music.ThumbMediaId);
            resxml.AppendFormat("<Description><![CDATA[{0}]]></Description></Music></xml>", music.Description);
            Response(param, resxml.ToString());
        }
Beispiel #2
0
        /// <summary>
        /// 回复图文
        /// </summary>
        public void ResArticles(EnterParam param, List <ResArticle> artList)
        {
            var resxml = new StringBuilder();

            resxml.AppendFormat("<xml><ToUserName><![CDATA[{0}]]></ToUserName>", FromUserName);
            resxml.AppendFormat("<FromUserName><![CDATA[{0}]]></FromUserName>", ToUserName);
            resxml.AppendFormat("<CreateTime>{0}</CreateTime>", Utils.ConvertDateTimeInt(DateTime.Now));
            resxml.Append("<MsgType><![CDATA[news]]></MsgType>");
            resxml.AppendFormat("<ArticleCount>{0}</ArticleCount><Articles>", artList.Count);
            foreach (var article in artList)
            {
                resxml.AppendFormat("<item><Title><![CDATA[{0}]]></Title>", article.Title);
                resxml.AppendFormat("<PicUrl><![CDATA[{0}]]></PicUrl>", article.PicUrl);
                resxml.AppendFormat("<Url><![CDATA[{0}]]></Url>", article.Url);
                resxml.AppendFormat("<Description><![CDATA[{0}]]></Description></item>", article.Description);
            }
            resxml.Append("</Articles></xml>");
            Response(param, resxml.ToString());
        }