コード例 #1
0
        /// <summary>
        /// 提交喜欢
        /// </summary>
        /// <param name="task"></param>
        public void PostLike(Beauty.App.BeautyService.WebTask task)
        {
            //http://www.meilishuo.com/aw/twitter/like
            //stid=1724688975
            try
            {
                Beauty.App.BeautyService.WebLike like = client.GetLike(task.Taskid.ToString());
                if (like != null)
                {
                    Beauty.App.BeautyService.WebBady bady = client.GetBady(like.Bady.ID.ToString());
                    string html = HttpHelper.GetHtml("http://www.meilishuo.com/aw/twitter/like", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0", "application/json, text/javascript, */*; q=0.01", "application/x-www-form-urlencoded; charset=UTF-8", "stid=" + bady.Twitterid, true, user.Cookie, null, Encoding.UTF8, null, true);
                    //{"code":0,"data":1740967646}

                    JavaScriptSerializer serializer = new JavaScriptSerializer();
                    PostLikeResult       obj        = serializer.Deserialize <PostLikeResult>(html);
                    if (obj.code.HasValue && obj.code.Value == 0)
                    {
                        writelog("完成喜欢任务");
                        client.BeginCompletelikeTask(task.ID.ToString(), like.ID.ToString(), null, null);
                    }
                }
            }
            catch (Exception ex)
            {
                string errorMsg = "An application error occurred. Please contact the adminstrator " +
                                  "with the following information:/n/n";
                errorMsg += ex.Message + "/n/nStack Trace:/n" + ex.StackTrace + "//" + ex.Source;
                client.BeginLog(errorMsg, null, null);
            }
        }