Пример #1
0
        /// <summary>
        /// 提交评论
        /// </summary>
        /// <param name="task"></param>
        public void PostComment(Beauty.App.BeautyService.WebTask task)
        {
            Beauty.App.BeautyService.WebLike like = client.GetLike(task.Taskid.ToString());
            if (like != null)
            {
                Beauty.App.BeautyService.WebBady bady = client.GetBady(like.Bady.ID.ToString());
                if (!string.IsNullOrEmpty(bady.Twitterid))
                {
                    string postdata = "stid=" + bady.Twitterid + "&type=4&tContent=" + task.Comment;

                    string html = HttpHelper.GetHtml("http://www.meilishuo.com/aw/twitter/create", "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", postdata, true, user.Cookie, null, Encoding.UTF8, null, true);
                    try
                    {
                        JavaScriptSerializer serializer   = new JavaScriptSerializer();
                        PostShareResult      resultobject = serializer.Deserialize <PostShareResult>(html);
                        if (resultobject.code.HasValue && resultobject.code.Value == 0)
                        {
                            //client.CompleteShareTask(task.ID.ToString(), task.Taskid.ToString(), bady.ID.ToString(), obj.data.gInfo.goodsID.ToString(), resultobject.data.twitter_id.ToString(), resultobject.data.group_id.ToString());
                            client.BeginCompletelikeTask(task.ID.ToString(), like.ID.ToString(), null, null);
                            writelog("完成评论任务");
                        }
                    }
                    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);
                    }
                }
            }
        }
Пример #2
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);
            }
        }
Пример #3
0
        /// <summary>
        /// 提交粉丝
        /// </summary>
        /// <param name="task"></param>
        public void PostLiked(Beauty.App.BeautyService.WebTask task)
        {
            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/share/" + bady.Twitterid, "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0", "application/json, text/javascript, */*; q=0.01", null, user.Cookie, null, Encoding.UTF8, null);
                    HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
                    doc.LoadHtml(html);
                    HtmlNode node = doc.DocumentNode.SelectSingleNode(@"//span[@class='btn addFollow']");
                    if (node != null)
                    {
                        string id       = node.Attributes["fuid"].Value;
                        string postdata = "fuid=" + id;
                        html = HttpHelper.GetHtml("http://www.meilishuo.com/aw/user/follow", "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", postdata, true, user.Cookie, null, Encoding.UTF8, null, true);

                        JavaScriptSerializer serializer   = new JavaScriptSerializer();
                        PostLikedResult      resultobject = serializer.Deserialize <PostLikedResult>(html);
                        if (resultobject.code.HasValue && resultobject.code.Value == 0)
                        {
                            //client.CompleteShareTask(task.ID.ToString(), task.Taskid.ToString(), bady.ID.ToString(), obj.data.gInfo.goodsID.ToString(), resultobject.data.twitter_id.ToString(), resultobject.data.group_id.ToString());
                            client.BeginCompletelikeTask(task.ID.ToString(), like.ID.ToString(), null, null);
                            writelog("完成粉丝任务");
                        }
                    }
                }
            }
            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);
            }
        }
Пример #4
0
        /// <summary>
        /// 提交收录
        /// </summary>
        /// <param name="task"></param>
        public void PostRecord(Beauty.App.BeautyService.WebTask task)
        {
            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());
                    Beauty.App.BeautyService.WebShare share = client.GetShareByBady(bady.ID.ToString());
                    if (share != null)
                    {
                        string type = task.Type;
                        ///分组为空时立马获取分组
                        if (string.IsNullOrEmpty(type))
                        {
                            //Beauty.App.BeautyService.WebGroup group = null;

                            if (string.IsNullOrEmpty(task.Type))
                            {
                                ///update group

                                string html = HttpHelper.GetHtml("http://www.meilishuo.com/aj/magazine/user_groups", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0", "application/json, text/javascript, */*; q=0.01", null, "", true, user.Cookie, null, Encoding.GetEncoding("gb2312"), null, true);
                                JavaScriptSerializer serializer = new JavaScriptSerializer();
                                List <UserGroup>     objs       = serializer.Deserialize <List <UserGroup> >(html);
                                if (objs != null && objs.Count > 0)
                                {
                                    foreach (UserGroup usergroup in objs)
                                    {
                                        if (usergroup.name.Contains(share.Keyword))
                                        {
                                            //group = new BeautyService.WebGroup { Name = usergroup.name, ID = usergroup.group_id };
                                            type = usergroup.group_id;
                                        }
                                        client.BeginUpdateGroup(user.Username, usergroup.group_id, usergroup.name, null, null);
                                    }

                                    if (string.IsNullOrEmpty(type) && objs.Count > 0)
                                    {
                                        type = objs[0].group_id;
                                    }
                                }
                            }
                        }

                        if (!string.IsNullOrEmpty(type))
                        {
                            string postdata = "type=8&stid=" + bady.Twitterid + "&tContent=" + task.Comment + "&name=" + user.Username + "&group_id=" + type + "&syncToQzone=false&syncToWeibo=false";
                            string html     = HttpHelper.GetHtml("http://www.meilishuo.com/aw/twitter/create", "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", postdata, true, user.Cookie, null, Encoding.UTF8, null, true);

                            JavaScriptSerializer serializer   = new JavaScriptSerializer();
                            PostShareResult      resultobject = serializer.Deserialize <PostShareResult>(html);
                            if (resultobject.code.HasValue && resultobject.code.Value == 0)
                            {
                                //client.CompleteShareTask(task.ID.ToString(), task.Taskid.ToString(), bady.ID.ToString(), obj.data.gInfo.goodsID.ToString(), resultobject.data.twitter_id.ToString(), resultobject.data.group_id.ToString());
                                client.BeginCompletelikeTask(task.ID.ToString(), like.ID.ToString(), null, null);
                                writelog("完成收录任务");
                            }
                        }
                    }
                }
            }
            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);
            }
        }