Example #1
0
        private void addReply()
        {
            int    mailid   = GetFormValue("mailid", 0);
            int    SendType = GetFormValue("sendtype", 0);
            string content  = HttpUtility.UrlDecode(GetFormValue("content", ""));
            string auth     = GetFormValue("auth", "");
            string title    = HttpUtility.UrlDecode(GetFormValue("title", ""));
            int    userId   = 0;

            if (!string.IsNullOrEmpty(auth))
            {
                userId = UserLogic.GetUserIdByAuthToken(auth);
                if (userId == 0)
                {
                    json = JsonHelper.JsonSerializer(new ResultModel(ApiStatusCode.令牌失效));
                    return;
                }
                var user = UserLogic.GetModel(userId);


                MailModel model = new MailModel();
                model.AuthorId    = -1;
                model.AuthorName  = user.NickName;
                model.Title       = title;
                model.BodyContent = content;
                model.CoverUrl    = user.UserHeadImg;
                model.SendType    = SendType;
                model.ReplyPid    = mailid;
                model.ReplyUserId = userId;
                model.PhoneModel  = HttpUtility.UrlDecode(GetFormValue("pm", ""));
                if (ArticleLogic.AddMailInfo(model) > 0)
                {
                    //将该消息接收人的已阅读状态改为未读
                    LogLogic.UpdateMailNotReadStatus(userId, mailid);
                    json = JsonHelper.JsonSerializer(new ResultModel(ApiStatusCode.OK));
                }
            }
            else
            {
                json = JsonHelper.JsonSerializer(new ResultModel(ApiStatusCode.令牌失效));
            }
        }