/// <summary> /// 论坛互动分页 /// </summary> public void GetCommentList() { List <PeopleComments> listComment = new List <PeopleComments>(); int topic_id = Convert.ToInt32(context.Request["topic_id"]); string topic_type = context.Request["topic_type"]; int pageIndex = string.IsNullOrEmpty(context.Request["pageIndex"]) ? 1 : Convert.ToInt32(context.Request["pageIndex"]); int PageSize = Convert.ToInt32(context.Request["PageSize"]); int pageCount = 0; int recordcount = 0; var result = PageList.GetPageList <Z_Comment, int>(c => c.topic_type == topic_type && c.topic_id == topic_id, c => c.ZanCount, c => c.addtime, PageSize, pageIndex, out recordcount, out pageCount); foreach (var item in result) { PeopleComments Comment = new PeopleComments(); Comment.comment = item; Comment.reCommentList = ZCommentservice.GetReplyCommentListByID(item.comment_guid); listComment.Add(Comment); } var obj = new { list = listComment, recordcount = recordcount, pageCount = pageCount }; string msg = JsonConvert.SerializeObject(obj); context.Response.Write(msg); }
/// <summary> /// 取前10条点赞的评论和评论的回复 /// </summary> public List <PeopleComments> GetCommentListByID(int topic_id, string topic_type, int count) { using (AIYunNetContext context = new AIYunNetContext()) { List <PeopleComments> listComment = new List <PeopleComments>(); List <Z_Comment> list = new List <Z_Comment>(); list = context.Z_Comment.Where(wc => wc.topic_id == topic_id && wc.topic_type == topic_type).OrderByDescending(wc => wc.ZanCount).OrderBy(wc => wc.addtime).Take(count).ToList(); foreach (var arr in list) { PeopleComments Comment = new PeopleComments(); Comment.comment = arr; Comment.reCommentList = GetReplyCommentListByID(arr.comment_guid); listComment.Add(Comment); } return(listComment); } }