Exemplo n.º 1
0
        public override string ReplyExecute(replyBase json)
        {
            RpArticles art = json as RpArticles;

            string resxml = string.Empty;
            int    count  = 0;

            resxml += string.Format(@"<xml>
                                            <ToUserName><![CDATA[{0}]]></ToUserName>  
                                            <FromUserName><![CDATA[{1}]]></FromUserName>  
                                            <CreateTime>{2}</CreateTime>  
                                            <MsgType><![CDATA[news]]></MsgType>  
                                            <ArticleCount>{3}</ArticleCount>  
                                            <Articles>",
                                    art.xmlmsg.ToUserName, art.xmlmsg.FromUserName, SerializeHelper.longtime().ToString(), art.newslist.Count);
            foreach (newslist itemArticles in art.newslist)
            {
                count++;
                if (count <= 10)
                {
                    resxml += string.Format(@"<item>  
                                            <Title><![CDATA[{0}]]></Title>   
                                            <Description><![CDATA[{1}]]></Description>  
                                            <PicUrl><![CDATA[{2}]]></PicUrl>  
                                            <Url><![CDATA[{3}]]></Url>  
                                            </item>",
                                            itemArticles.title, itemArticles.description, itemArticles.picUrl, itemArticles.url);
                }
            }
            resxml += "</Articles></xml>  ";
            return(resxml);
        }
Exemplo n.º 2
0
        public override string Execute(InfoBase json)
        {
            bool   connect = false;
            string xml     = string.Empty;

            try
            {
                //组建参数字典
                Dictionary <string, string> Para = new Dictionary <string, string>();
                Para.Add("num", "4");
                Para.Add("rand", "1");

                string     path    = RequestPath.CreatePathApi("/txapi/weixin/wxhot");
                RpArticles newList = HTMLHelper.Get <RpArticles>(path, Para, ref connect, ShareData.baiduapikey);
                if (newList.code == "200" && newList != null)
                {
                    newList.xmlmsg = json;
                    xml            = new replyImageText().ReplyExecute(newList);
                }
            }
            catch (Exception ex)
            {
                TracingHelper.Error(ex, typeof(TouTiao), ex.Message);
            }
            return(xml);
        }
Exemplo n.º 3
0
        public override string Execute(InfoBase json)
        {
            bool   connect = false;
            string xml     = string.Empty;

            try
            {
                //组建参数字典
                Dictionary <string, string> Para = new Dictionary <string, string>();
                //Para.Add("key", ShareData.QAkye);
                //Para.Add("info", json.Contents);
                //Para.Add("userid", ShareData.QAuserid);

                string     path    = RequestPath.CreatePathApi("/turing/turing/turing");
                RpArticles newList = HTMLHelper.Get <RpArticles>(path, Para, ref connect, ShareData.baiduapikey);
                if (newList.code == "200" && newList != null)
                {
                    newList.xmlmsg = json;
                    xml            = new replyImageText().ReplyExecute(newList);
                }
            }
            catch (Exception ex)
            {
                TracingHelper.Error(ex, typeof(DeepQA), ex.Message);
            }
            return(xml);
        }