예제 #1
0
 public JsonResult DeleteLink(int id)
 {
     JsonViewResult json = new JsonViewResult();
     json.Success = friendLinkLogic.DeleteFriendLink(id);
     if(json.Success)
     {
         WebCache.Remove(friendLinkLogic.FriendLinksKey);
     }
     return Json(json, JsonRequestBehavior.AllowGet);
 }
예제 #2
0
        public JsonResult GetPwd(string userEmail)
        {
            JsonViewResult json = new JsonViewResult();
            if (string.IsNullOrEmpty(userEmail) || !Utility.IsEmail(userEmail))
            {
                json.Message = "邮箱格式不正确!";
                return Json(json, JsonRequestBehavior.AllowGet);
            }
            var userinfo = userBusinessLogic.GetUserInfoByEmail(userEmail);
            if (userinfo == null)
            {
                json.Success = false;
                json.Message = "找不到用户信息,请确认邮箱输入正确!";
                return Json(json, JsonRequestBehavior.AllowGet);
            }

            var getpwdRecord = userBusinessLogic.GetPwdRecord(userinfo.ID);
            if (getpwdRecord != null)
            {
                json.Message = "已发送,请查收邮箱";
                json.Success = true;
                return Json(json, JsonRequestBehavior.AllowGet);
            }

            T_GetPwd getpwd = new T_GetPwd()
            {
                AddDate = DateTime.Now,
                Guid = Guid.NewGuid().ToString("N"),
                UserID = userinfo.ID,
                ExpireDate = DateTime.Now.AddHours(3),
                State = 1
            };

            json.Success = userBusinessLogic.AddGetPwdRecord(getpwd);
            json.Message = "已发送,请查收邮箱";
            string url = "http://" + Request.Url.Authority + "/home/ResetPwd?guid=" + getpwd.Guid;
            NoticeMail.GetPassword(userinfo.UserName, userinfo.Email, url);
            return Json(json, JsonRequestBehavior.AllowGet);
        }
예제 #3
0
        public ActionResult DeleteUser(int uid)
        {
            JsonViewResult jsonViewResult = new JsonViewResult() { Success = false };
            int userJokesCount = jokeLogic.JokesCount(uid);
            var userinfo = userLogic.GetUserInfo(uid);
            if (userinfo.IsAdmin > 0)
            {
                jsonViewResult.Success = false;
                jsonViewResult.Message = "不能删除管理员";
                return Json(jsonViewResult, JsonRequestBehavior.AllowGet);
            }
            if (userJokesCount > 0)
            {
                jsonViewResult.Success = false;
                jsonViewResult.Message = "该会员已发表过笑话,不能删除该会员!";
            }
            else
            {
                jsonViewResult.Success = userLogic.DeleteUser(uid);

            }
            return Json(jsonViewResult, JsonRequestBehavior.AllowGet);
        }
예제 #4
0
        public JsonResult ResetPwd(string guid, string password, string configpwd)
        {
            JsonViewResult json = new JsonViewResult();

            if (string.IsNullOrEmpty(guid) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(configpwd))
            {
                json.Success = false;
                json.Message = "请输入密码和确认密码!";
                json.Status = 1;
                return Json(json, JsonRequestBehavior.AllowGet);
            }

            if (password.Length < 6)
            {
                json.Success = false;
                json.Message = "密码长度小于6位!";
                json.Status = 1;
                return Json(json, JsonRequestBehavior.AllowGet);
            }

            var getpwd = userBusinessLogic.GetPwdRecord(guid);
            if (getpwd == null)
            {
                json.Success = false;
                json.Message = "修改状态不正确,请重新提交修改申请!";
                return Json(json, JsonRequestBehavior.AllowGet);
            }

            var userinfo = userBusinessLogic.GetUserInfo(getpwd.UserID);
            if (userinfo == null)
            {
                json.Success = false;
                json.Message = "用户状态不正确!";
                return Json(json, JsonRequestBehavior.AllowGet);
            }

            userinfo.Password = Md5.GetMd5(password);
            json.Success = userBusinessLogic.UpdateUserPwd(userinfo.ID, userinfo.Password);
            if (json.Success)
            {
                json.Message = "密码修改成功!";
                getpwd.State = 0;
                userBusinessLogic.UpdateGetPwd(getpwd);
            }
            else
            {
                json.Message = "密码修改失败!";
            }
            return Json(json, JsonRequestBehavior.AllowGet);
        }
예제 #5
0
 public JsonResult DeleteJoke(int id=0)
 {
     JsonViewResult jsonViewResult = new JsonViewResult() { Success = false };
     jsonViewResult.Success = jokeBusinessLogic.DeleteJoke(id);
     return Json(jsonViewResult, JsonRequestBehavior.AllowGet);
 }
예제 #6
0
 public JsonResult DeleteComment(int commentid)
 {
     JsonViewResult jsonViewResult = new JsonViewResult() { Success = false };
     jsonViewResult.Success = jokeBusinessLogic.CommentDelete(commentid);
     return Json(jsonViewResult,JsonRequestBehavior.AllowGet);
 }
예제 #7
0
        public ActionResult PostComment(CommentPostModel commentPost)
        {
            JsonViewResult json = new JsonViewResult() { Success = false };
            if(!ModelState.IsValid)
            {
                json.Success = false;
                json.Message = "输入错误";
                return Json(json, JsonRequestBehavior.AllowGet);
            }

            string verifyCode = Session["ValidateCode"] as string;
            if(verifyCode.ToLower()!=commentPost.VerifyCode)
            {
                json.Success = false;
                json.Message = "验证码输入错误";
                return Json(json, JsonRequestBehavior.AllowGet);
            }

            var jokeinfo = jokeBusinessLogic.JokeDetailGet(commentPost.JokeID);

            T_Comment commentDomain = new T_Comment();
            commentDomain.AddDate = DateTime.Now;
            commentDomain.Content = commentPost.Comment;
            commentDomain.Floor = jokeinfo.CommentCount+1;
            commentDomain.JokeId = commentPost.JokeID;
            commentDomain.UserID = user.UserId;
            jokeinfo.CommentCount = jokeinfo.CommentCount + 1;
            jokeBusinessLogic.UpdateJoke(jokeinfo);
            json.Success = jokeBusinessLogic.AddComment(commentDomain);
            return Json(json,JsonRequestBehavior.AllowGet);
        }
예제 #8
0
 public JsonResult JokeFollow(int jokeid,int type)
 {
     JsonViewResult jsonResult = new JsonViewResult();
     var jokeinfo = jokeBusinessLogic.JokeDetailGet(jokeid);
     if(type==1)
     {
         jokeinfo.LikeCount = jokeinfo.LikeCount + 1;
     }
     else if(type==2)
     {
         jokeinfo.HateCount = jokeinfo.HateCount + 1;
     }
     jokeBusinessLogic.UpdateJoke(jokeinfo);
     jsonResult.Success = true;
     return Json(jsonResult,JsonRequestBehavior.AllowGet);
 }
예제 #9
0
 public JsonResult DeleteJoke(int jokeid)
 {
     JsonViewResult jsonViewResult = new JsonViewResult();
     jsonViewResult.Success = jokeLogic.DeleteJoke(jokeid);
     return Json(jsonViewResult, JsonRequestBehavior.AllowGet);
 }
예제 #10
0
        public JsonResult Verify(int jokeid, int type)
        {
            JsonViewResult jsonViewResult = new JsonViewResult();
            var jokeinfo = jokeLogic.JokeDetailGet(jokeid);
            if (jokeinfo == null || jokeinfo.State == 1)
            {
                jsonViewResult.Success = false;
            }
            else
            {
                jokeinfo.State = 1;
                jokeinfo.CheckDate = DateTime.Now;
                jokeinfo.CheckUserId = user.UserId;
                jokeLogic.UpdateJoke(jokeinfo);
                jsonViewResult.Success = true;

                // 发送审核
                var userinfo = userLogic.GetUserInfo(jokeinfo.PostID);
                string jokeUrl = string.Format("http://{0}/joke{1}.html", Request.Url.Authority, jokeinfo.ID);
                NoticeMail.VerifyNotice(userinfo.UserName, userinfo.Email, jokeinfo.Title, jokeUrl);

            }
            return Json(jsonViewResult, JsonRequestBehavior.AllowGet);
        }
예제 #11
0
 public JsonResult UpdateUserState(int uid, int state)
 {
     JsonViewResult jsonViewResult = new JsonViewResult();
     var userinfo = userLogic.GetUserInfo(uid);
     userinfo.State = state;
     jsonViewResult.Success = userLogic.UpdateUserInfo(userinfo);
     return Json(jsonViewResult, JsonRequestBehavior.AllowGet);
 }