示例#1
0
 public static void SaveData(ReqModel data)
 {
     if (data.content.Contains("可能拼写有误") || data.content.Contains("或者正在查找的页面不再可用"))
     {
         numError++;
         return;
     }
     if (ListData == null)
     {
         ListData = new List <ReqModel>();
     }
     if (!ListData.Any(a => a.title == data.title))
     {
         ListData.Add(data);
     }
     //bool ret = WebPassport.WeiBoHelper.PublishArticle(data);
 }
示例#2
0
        public static RetModel PublishArticle(ReqModel model)
        {
            try
            {
                model.text         = model.title;
                model.cover        = "";// qr_img;
                model.access_token = access_token;

                //model.content = model.title;
                //string param = string.Format("title={0}&content={1}&cover={2}&summary={3}&text={4}&access_token={5}", model.title, RFC3986Encoder.Encode(model.content), RFC3986Encoder.Encode(model.cover), model.summary, model.text, model.access_token);
                string param = string.Format("title={0}&content={1}&cover={2}&summary={3}&text={4}&access_token={5}", model.title, System.Web.HttpUtility.UrlEncode(model.content), System.Web.HttpUtility.UrlEncode(model.cover), model.summary, model.text, model.access_token);

                var ret = HttpUtil.PostWebRequest <RetModel>(req_url, param, Encoding.UTF8);
                return(ret);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }