public JsonResult Reply(int topicId, string reply)
        {
            if (B_StaticObject.swh.HasBadWord(string.Concat(reply)))
            {
                return(Json(new { status = "1", message = "标题或者内容中含有敏感词汇,不能提交!", value = 0 }));
            }

            T_Reply m = new T_Reply();

            m.UserId       = this.UserInfo.Id;
            m.TopicId      = topicId;
            m.ReplyContent = processQuote(ProcessBigPic(reply, 900));
            m.CreateDate   = DateTime.Now;
            m.Deleted      = false;
            m.Blocked      = false;
            m.Ip           = ClientUtil.Ip;
            m.Good         = 0;
            int i = B_Topic.AddReply(m);

            if (i > 0)
            {
                B_Topic.AddTopicReplyCount(topicId);
                return(Json(new { status = "0", message = "", value = i }));
            }
            else
            {
                return(Json(new { status = "1", message = "发表回复失败!", value = 0 }));
            }
        }
Beispiel #2
0
        public static int AddReply(T_Reply m)
        {
            string sql = "insert into T_Reply(Id, UserId, TopicId, ReplyContent, CreateDate, Deleted, Blocked, Ip, Good) values(null, @UserId, @TopicId, @ReplyContent, @CreateDate, @Deleted, @Blocked, @Ip, @Good) ";

            MySqlParameter[] p = new MySqlParameter[]
            {
                "@UserID".ToInt32InPara(m.UserId),
                "@TopicId".ToInt32InPara(m.TopicId),
                "@ReplyContent".ToVarCharInPara(m.ReplyContent),
                "@CreateDate".ToDateTimeInPara(m.CreateDate),
                "@Deleted".ToBitInPara(m.Deleted),
                "@Blocked".ToBitInPara(m.Blocked),
                "@Ip".ToVarCharInPara(m.Ip),
                "@Good".ToInt32InPara(m.Good)
            };
            int i = MySqlHelper.ExecuteNonQuery(Util.GetConnectString(BBSConnString), sql, p);

            return(i);
        }