Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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)));
        }
Ejemplo n.º 3
0
        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));
        }
Ejemplo n.º 4
0
 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 + ":");
     }
 }
Ejemplo n.º 5
0
        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));
        }
Ejemplo n.º 6
0
        public int GetIsPraise(int commentId, string userId)
        {
            int i = ArticleCommentSystem.GetIsPraise(commentId, userId);

            return(i);
        }
Ejemplo n.º 7
0
 /// <summary>
 /// 点赞总数
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public int CountPraise(int id)
 {
     return(ArticleCommentSystem.CountPraise(id));
 }
Ejemplo n.º 8
0
 public ActionResult GetCountCommentBYId(int PKID, string UserID)
 {
     return(Json(ArticleCommentSystem.GetCountCommentBYId(PKID, UserID)));
 }