public ActionResult ArticleCommentTop3(int PKID, string UserID) { var modeltTop3 = ArticleCommentSystem.GetArticleCommentTop3(PKID, UserID) .Select(a => new { a.ID, a.AuditStatus, a.Category, a.CommentContent, CommentTime = formatCommentTime(a.CommentTime), CommentNum = CountComment(a.ID), PraiseNum = CountPraise(a.ID), a.PhoneNum, a.Title, UserHead = a.UserHead.Replace("img", "image"), UserName = GetUserName(a.UserName, a.RealName, a.PhoneNum, a.Sex), a.UserGrade, a.floor, a.ParentID, ParentName = GetUserNameByID(a.ParentID), IsPraise = GetIsPraise(a.ID, UserID) }); return(Json(modeltTop3)); }
public ActionResult InsertCommentPraise(CommentPraise model) { if (string.IsNullOrWhiteSpace(model.UserId)) { return(Json(200)); } //if (!string.IsNullOrWhiteSpace(model.RealName) && !string.IsNullOrWhiteSpace(model.Sex)) //{ // if (model.Sex.Trim().Equals("男")) // { // model.RealName = model.RealName.Substring(0, 1) + "先生"; // } // else if (model.Sex.Trim().Equals("女")) // { // model.RealName = model.RealName.Substring(0, 1) + "小姐"; // } //} if (!string.IsNullOrWhiteSpace(model.PhoneNum)) { model.PhoneNum = model.PhoneNum.Substring(0, 3) + "****" + model.PhoneNum.Substring(7, 4); } return(Json(ArticleCommentSystem.InsertCommentPraise(model))); }
public ActionResult ArticleCommentV1(int PKID, string UserID, int PageIndex = 1) { var PageSize = 10; int TotalCount = 0; var comments = ArticleCommentSystem.GetArticleCommentByPKID(PKID, UserID, out TotalCount, PageIndex, PageSize) .Select(a => new { a.ID, a.AuditStatus, a.Category, a.CommentContent, CommentTime = formatCommentTime(a.CommentTime), CommentNum = CountComment(a.ID), PraiseNum = CountPraise(a.ID), a.PhoneNum, a.Title, UserHead = a.UserHead.Replace("img", "image"), UserName = GetUserName(a.UserName, a.RealName, a.PhoneNum, a.Sex), a.UserGrade, a.floor, ParentName = GetUserNameByID(a.ParentID), IsPraise = GetIsPraise(a.ID, UserID) }); return(Json(comments)); }
public string GetUserNameByID(string id) { if (string.IsNullOrWhiteSpace(id)) { return(""); } else { string name = ArticleCommentSystem.GetUserNameByID(Convert.ToInt32(id)); if (name.StartsWith("1") && name.Length == 11) { name = name.Substring(0, 3) + "****" + name.Substring(7, 4); } return("<span style='color:blue;'>回复</span> " + name + ":"); } }
public ActionResult ArticleComment(int PKID, string UserID, int PageIndex = 1) { var PageSize = 10; var comments = ArticleCommentSystem.SelectArticleCommentByPKID(PKID, UserID, PageIndex, PageSize) .Select(a => new { a.AuditStatus, a.Category, a.CommentContent, CommentTime = formatCommentTime(a.CommentTime), a.PhoneNum, a.Title, a.UserHead, a.UserName, a.UserGrade, a.floor }); return(Json(comments)); }
public int GetIsPraise(int commentId, string userId) { int i = ArticleCommentSystem.GetIsPraise(commentId, userId); return(i); }
/// <summary> /// 点赞总数 /// </summary> /// <param name="id"></param> /// <returns></returns> public int CountPraise(int id) { return(ArticleCommentSystem.CountPraise(id)); }
public ActionResult GetCountCommentBYId(int PKID, string UserID) { return(Json(ArticleCommentSystem.GetCountCommentBYId(PKID, UserID))); }