/// <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); } }