public ActionResult NewBeeFloorReplyDelete(Guid id) { NewBeeFloorReply reply = NewBeeFloorReplyDataSvc.GetByID(id); if (reply.OwnerID != CurrentUser.ID) { return(Json(new { msg = "错误" })); } reply.Delete = true; NewBeeFloorReplyDataSvc.Update(reply); return(Json(new { msg = "done" })); }
public ActionResult AddNewBeeFloorReply(Guid floorID, Guid toUserID, string txt) { DisabledUser user = MyRedisDB.GetSet <DisabledUser>(MyRedisKeys.DisabledUsers).Where(d => d.UserID == CurrentUser.ID && d.ObjectType == (int)EnumObjectType.NewBee && 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 = "参数太长" })); } NewBeeFloor floor = NewBeeFloorDataSvc.GetByID(floorID); floor.ReplyCount += 1; NewBeeFloorReply reply = new NewBeeFloorReply(); reply.NewBeeFloorID = floorID; reply.Content = HttpUtility.HtmlEncode(txt); reply.ToUserID = toUserID; reply.OwnerID = CurrentUser.ID; reply.Order = floor.ReplyCount; NewBeeFloorReplyDataSvc.Add(reply); NewBeeFloorDataSvc.Update(floor); if (toUserID != CurrentUser.ID) { string key = MyRedisKeys.Pre_RMsg + toUserID; RMsg bcrmsg = new RMsg(); bcrmsg.ObjType = (int)EnumObjectType.NewBee; bcrmsg.ObjID = floor.NewBeeID; bcrmsg.Date = DateTime.Now; bcrmsg.From = CurrentUser.UserName; bcrmsg.COrder = floor.Order; bcrmsg.ROrder = reply.Order; bcrmsg.Title = txt.MaxByteLength(32); MyRedisDB.SetAdd(key, bcrmsg); } return(Json(new { msg = "done" })); }