public ApiResponse DynamicReplayList(string dynamicIds, int pageSize = 5, int lastId = 0) { List <string> dynamicIdList = string.IsNullOrEmpty(dynamicIds) ? new List <string>() : dynamicIds.Split(',').ToList(); List <DynamicModel> dynamicReplayList = dynamicBll.DynamicReplayListBydynamicIds(dynamicIds, pageSize, lastId); var resultList = dynamicIdList.Select(c => new { DynamicId = c, CommentList = (dynamicReplayList != null && dynamicReplayList.Count > 0) ? dynamicReplayList.Where(o => o.ReplayId.ToString() == c).Select(r => new { AddTime = DateTimeUtility.GetDisplayTime(r.AddTime), r.DynamicContent, WrapComment = GetContentFace(r.DynamicContent), r.UserId, r.UserName, r.Portrait, CommentId = r.Id, r.ReplyCommentId, r.ReplayUserId, r.ReplayUserName }) : null }); return(new ApiResponse(Metas.SUCCESS, resultList)); }
/// <summary> /// 回复列表 /// </summary> /// <returns></returns> public JsonResult DynamicReplayList(string dynamicIds, int pageSize = 5, int lastId = 0) { List <string> dynamicIdList = string.IsNullOrEmpty(dynamicIds) ? new List <string>() : dynamicIds.Split(',').ToList(); List <DynamicModel> dynamicReplayList = dynamicBll.DynamicReplayListBydynamicIds(dynamicIds, pageSize, lastId); var resultList = dynamicIdList.Select(c => new { DynamicId = c, CommentList = (dynamicReplayList != null && dynamicReplayList.Count > 0) ? dynamicReplayList.Where(o => o.ReplayId.ToString() == c).Select(r => new { AddTime = DateTimeUtility.GetDisplayTime(r.AddTime), r.DynamicContent, r.UserId, r.UserName, r.Portrait, r.Id, r.ReplyCommentId, r.ReplayUserId, r.ReplayUserName }) : null }); return(Json(new { data = resultList }, JsonRequestBehavior.AllowGet)); }
private dynamic FormatDyamic(DynamicModel dynamicItem, List <DynamicImage> dynamicImageList, int userid) { return(new { dynamicItem.Abstract, AddTime = DateTimeUtility.GetDisplayTime(dynamicItem.AddTime), dynamicItem.CityId, dynamicItem.CityName, dynamicItem.ClickNum, dynamicItem.CommentNum, dynamicItem.DynamicContent, WrapComment = GetContentFace(dynamicItem.DynamicContent), dynamicItem.Id, ImageList = dynamicImageList.Select(i => new { i.ImageUrl, i.ImageHeight, i.ImageWidth }), Ip = dynamicItem.Ip, IsEssence = dynamicItem.IsEssence, dynamicItem.IsHelp, dynamicItem.IsHot, dynamicItem.IsMentionAll, IsTop = (dynamicItem.TopTime != null && dynamicItem.TopTime > DateTime.Now)?1:0, dynamicItem.LastCommentId, LastCommentTime = dynamicItem.LastCommentTime.ToString(),//DateTimeUtility.ToUnixTime_Milliseconds(d.LastCommentTime), dynamicItem.Lat, dynamicItem.Lng, dynamicItem.Location, dynamicItem.ShareNum, dynamicItem.State, dynamicItem.Title, TopTime = DateTimeUtility.ToUnixTime_Milliseconds(dynamicItem.TopTime), dynamicItem.Type, dynamicItem.UserId, dynamicItem.Visible, dynamicItem.VoteId, dynamicItem.UserName, dynamicItem.Portrait, SupportList = dynamicItem.SupportList != null?dynamicItem.SupportList.Select(s => new { s.UserName, s.UserId, s.Id, s.DynamicId }) : null, IsSupport = dynamicItem.SupportList != null && dynamicItem.SupportList.Where(s => s.UserId == userid).ToList().Count > 0 ? true : false, RemindUsers = new List <int>(), CompanyName = dynamicItem.CompanyName }); }
private dynamic FormatDyamic(DynamicModel dynamicItem, List <DynamicImage> dynamicImageList, List <DynamicModel> dynamicModels, int userid) { return(new { dynamicItem.Abstract, AddTime = DateTimeUtility.GetDisplayTime(dynamicItem.AddTime), dynamicItem.CityId, dynamicItem.CityName, dynamicItem.ClickNum, dynamicItem.CommentNum, dynamicItem.DynamicContent, WrapComment = GetContentFace(dynamicItem.DynamicContent), DynamicId = dynamicItem.Id, ImageList = dynamicImageList.Select(i => new { i.ImageUrl, i.ImageHeight, i.ImageWidth }), Ip = dynamicItem.Ip, IsEssence = dynamicItem.IsEssence, dynamicItem.IsHelp, dynamicItem.IsHot, dynamicItem.IsMentionAll, IsTop = (dynamicItem.TopTime != null && dynamicItem.TopTime > DateTime.Now) ? 1 : 0, dynamicItem.LastCommentId, LastCommentTime = DateTimeUtility.ToUnixTime(dynamicItem.LastCommentTime), dynamicItem.Lat, dynamicItem.Lng, dynamicItem.Location, dynamicItem.ShareNum, dynamicItem.State, dynamicItem.Title, TopTime = DateTimeUtility.ToUnixTime(dynamicItem.TopTime), dynamicItem.Type, dynamicItem.UserId, dynamicItem.Visible, dynamicItem.VoteId, dynamicItem.UserName, Portrait = string.IsNullOrEmpty(dynamicItem.Portrait)?"":dynamicItem.Portrait + "?imageMogr2/strip|imageView2/1/w/42/h/42/q/85", SupportList = dynamicItem.SupportList != null?dynamicItem.SupportList.Select(s => new { s.UserName, s.UserId, s.Id, s.DynamicId }) : null, ReplayList = dynamicModels.Select(r => new { AddTime = DateTimeUtility.GetDisplayTime(r.AddTime), r.DynamicContent, WrapComment = GetContentFace(r.DynamicContent), r.UserId, r.UserName, r.Portrait, CommentId = r.Id, ReplyCommentId = r.ReplyCommentId, ReplayUserId = r.ReplayUserId, ReplayUserName = r.ReplayUserName }), IsSupport = dynamicItem.SupportList != null && dynamicItem.SupportList.Where(s => s.UserId == userid).ToList().Count > 0 ? true : false, RemindUsers = new List <int>() }); }