public ActionResult BlogCommentDelete(Guid id) { BlogComment comment = BlogCommentDataSvc.GetByID(id); if (comment.OwnerID != CurrentUser.ID) { return(Json(new { msg = "错误" })); } comment.Delete = true; BlogCommentDataSvc.Update(comment); return(Json(new { msg = "done" })); }
public ActionResult AddBlogCommentReply(Guid commentID, Guid toUserID, string txt) { DisabledUser user = MyRedisDB.GetSet <DisabledUser>(MyRedisKeys.DisabledUsers).Where(d => d.UserID == CurrentUser.ID && d.ObjectType == (int)EnumObjectType.姿势 && d.AbleDate > DateTime.Now).FirstOrDefault(); if (user != null) { return(Json(new { msg = "你被封禁至" + user.AbleDate.ToString("yyyy-MM-dd HH:ss") })); } if (string.IsNullOrEmpty(txt)) { return(Json(new { msg = "参数错误" })); } if (txt.GetByteCount() > 400) { return(Json(new { msg = "参数太长" })); } BlogComment comment = BlogCommentDataSvc.GetByID(commentID); comment.ReplyCount += 1; BlogCommentReply reply = new BlogCommentReply(); reply.BlogCommentID = commentID; reply.Content = HttpUtility.HtmlEncode(txt); reply.ToUserID = toUserID; reply.OwnerID = CurrentUser.ID; reply.Order = comment.ReplyCount; BlogCommentReplyDataSvc.Add(reply); BlogCommentDataSvc.Update(comment); if (toUserID != CurrentUser.ID) { string key = MyRedisKeys.Pre_RMsg + toUserID; RMsg bcrmsg = new RMsg(); bcrmsg.ObjType = (int)EnumObjectType.姿势; bcrmsg.ObjID = comment.BlogID; bcrmsg.Date = DateTime.Now; bcrmsg.From = CurrentUser.UserName; bcrmsg.COrder = comment.Order; bcrmsg.ROrder = reply.Order; bcrmsg.Title = txt.MaxByteLength(32); MyRedisDB.SetAdd(key, bcrmsg); } return(Json(new { msg = "done" })); }