Ejemplo n.º 1
0
        public ActionResult NewNewBee(string title, string mdTxt, string mdValue)
        {
            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(title) || string.IsNullOrEmpty(mdTxt) || string.IsNullOrEmpty(mdValue))
            {
                return(Json(new { msg = "参数错误" }));
            }

            if (title.GetByteCount() > 100 || mdTxt.GetByteCount() > 2500 || mdValue.GetByteCount() > 5000)
            {
                return(Json(new { msg = "参数太长" }));
            }

            NewBee nb = new NewBee();

            nb.OwnerID       = CurrentUser.ID;
            nb.Title         = title;
            nb.FloorCount    = 1;
            nb.LastFloorDate = DateTime.Now;
            nb.Top           = false;
            NewBeeDataSvc.Add(nb);

            NewBeeFloor nbf = new NewBeeFloor();

            nbf.MDText   = mdTxt;
            nbf.MDValue  = HtmlST.Sanitize(mdValue);
            nbf.NewBeeID = nb.ID;
            nbf.Order    = 1;
            nbf.OwnerID  = CurrentUser.ID;
            NewBeeFloorDataSvc.Add(nbf);

            return(Json(new { msg = "done" }));
        }