Beispiel #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(BCW.Model.Reply model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tb_Reply set ");
            strSql.Append("UsID=@UsID,");
            strSql.Append("UsName=@UsName,");
            strSql.Append("Content=@Content,");
            strSql.Append("IsGood=@IsGood,");
            strSql.Append("IsTop=@IsTop,");
            strSql.Append("AddTime=@AddTime");
            strSql.Append(" where ID=@ID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID",      SqlDbType.Int,        4),
                new SqlParameter("@UsID",    SqlDbType.Int,        4),
                new SqlParameter("@UsName",  SqlDbType.NVarChar,  50),
                new SqlParameter("@Content", SqlDbType.NVarChar, 500),
                new SqlParameter("@IsGood",  SqlDbType.TinyInt,    1),
                new SqlParameter("@IsTop",   SqlDbType.Int,        4),
                new SqlParameter("@AddTime", SqlDbType.DateTime)
            };
            parameters[0].Value = model.ID;
            parameters[1].Value = model.UsID;
            parameters[2].Value = model.UsName;
            parameters[3].Value = model.Content;
            parameters[4].Value = model.IsGood;
            parameters[5].Value = model.IsTop;
            parameters[6].Value = model.AddTime;

            SqlHelper.ExecuteSql(strSql.ToString(), parameters);
        }
Beispiel #2
0
        /// <summary>
        /// 根据条件查询数据
        /// </summary>
        /// <param name="strWhere"></param>
        /// <returns></returns>
        public List <BCW.Model.Reply> GetReplysWhere(string strWhere)
        {
            List <BCW.Model.Reply> listReplys = new List <BCW.Model.Reply>();
            // 取出相关记录

            string queryString = "SELECT Floor,UsName,Content,FileNum,ReplyId,AddTime,UsID,ForumId,IsDel FROM tb_Reply where " + strWhere + " Order BY ID Desc";

            using (SqlDataReader reader = SqlHelper.ExecuteReader(queryString))
            {
                while (reader.Read())
                {
                    BCW.Model.Reply objReply = new BCW.Model.Reply();
                    objReply.Floor   = reader.GetInt32(0);
                    objReply.UsName  = reader.GetString(1);
                    objReply.Content = reader.GetString(2);
                    objReply.FileNum = reader.GetInt32(3);
                    objReply.ReplyId = reader.GetInt32(4);
                    objReply.AddTime = reader.GetDateTime(5);
                    objReply.UsID    = reader.GetInt32(6);
                    objReply.ForumId = reader.GetInt32(7);
                    objReply.IsDel   = reader.GetByte(8);
                    listReplys.Add(objReply);
                }
            }
            return(listReplys);
        }
Beispiel #3
0
        /// <summary>
        /// 取得每页记录
        /// </summary>
        /// <param name="p_pageIndex">当前页</param>
        /// <param name="p_pageSize">分页大小</param>
        /// <param name="p_recordCount">返回总记录数</param>
        /// <param name="strWhere">查询条件</param>
        /// <param name="strOrder">排序条件</param>
        /// <returns>IList Reply</returns>
        public IList <BCW.Model.Reply> GetReplysMe(int p_pageIndex, int p_pageSize, string strWhere, string strOrder, out int p_recordCount)
        {
            IList <BCW.Model.Reply> listReplys = new List <BCW.Model.Reply>();
            string sTable     = "tb_Reply";
            string sPkey      = "id";
            string sField     = "ID,Bid,Content,AddTime";
            string sCondition = strWhere;
            string sOrder     = strOrder;
            int    iSCounts   = 0;

            using (SqlDataReader reader = SqlHelper.RunProcedureMe(sTable, sPkey, sField, p_pageIndex, p_pageSize, sCondition, sOrder, iSCounts, out p_recordCount))
            {
                //计算总页数
                if (p_recordCount > 0)
                {
                    int pageCount = BasePage.CalcPageCount(p_recordCount, p_pageSize, ref p_pageIndex);
                }
                else
                {
                    return(listReplys);
                }
                while (reader.Read())
                {
                    BCW.Model.Reply objReply = new BCW.Model.Reply();
                    objReply.ID      = reader.GetInt32(0);
                    objReply.Bid     = reader.GetInt32(1);
                    objReply.Content = reader.GetString(2);
                    objReply.AddTime = reader.GetDateTime(3);
                    listReplys.Add(objReply);
                }
            }
            return(listReplys);
        }
Beispiel #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public BCW.Model.Reply GetReply(int Bid, int Floor)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ID,Floor,Bid,UsID,UsName,Content,FileNum,IsGood,IsTop,IsDel,ReplyId,ReStats,AddTime,CentText from tb_Reply ");
            if (Floor == 0)
            {
                strSql.Append(" where ID=@Bid ");
            }
            else
            {
                strSql.Append(" where Bid=@Bid ");
                strSql.Append(" and Floor=@Floor ");
            }
            SqlParameter[] parameters =
            {
                new SqlParameter("@Bid",   SqlDbType.Int, 4),
                new SqlParameter("@Floor", SqlDbType.Int, 4)
            };
            parameters[0].Value = Bid;
            parameters[1].Value = Floor;

            BCW.Model.Reply model = new BCW.Model.Reply();
            using (SqlDataReader reader = SqlHelper.ExecuteReader(strSql.ToString(), parameters))
            {
                if (reader.HasRows)
                {
                    reader.Read();
                    model.ID      = reader.GetInt32(0);
                    model.Floor   = reader.GetInt32(1);
                    model.Bid     = reader.GetInt32(2);
                    model.UsID    = reader.GetInt32(3);
                    model.UsName  = reader.GetString(4);
                    model.Content = reader.GetString(5);
                    model.FileNum = reader.GetInt32(6);
                    model.IsGood  = reader.GetByte(7);
                    model.IsTop   = reader.GetInt32(8);
                    model.IsDel   = reader.GetByte(9);
                    model.ReplyId = reader.GetInt32(10);
                    if (!reader.IsDBNull(11))
                    {
                        model.ReStats = reader.GetString(11);
                    }
                    model.AddTime = reader.GetDateTime(12);
                    if (!reader.IsDBNull(13))
                    {
                        model.CentText = reader.GetString(13);
                    }
                    return(model);
                }
                else
                {
                    return(null);
                }
            }
        }
Beispiel #5
0
        /// <summary>
        /// 取得每页记录
        /// </summary>
        /// <param name="p_pageIndex">当前页</param>
        /// <param name="p_pageSize">分页大小</param>
        /// <param name="p_recordCount">返回总记录数</param>
        /// <param name="strWhere">查询条件</param>
        /// <param name="strOrder">排序条件</param>
        /// <returns>IList Reply</returns>
        public IList <BCW.Model.Reply> GetReplys(int p_pageIndex, int p_pageSize, string strWhere, string strOrder, out int p_recordCount)
        {
            IList <BCW.Model.Reply> listReplys = new List <BCW.Model.Reply>();
            string sTable     = "tb_Reply";
            string sPkey      = "id";
            string sField     = "ID,Floor,ForumId,Bid,UsID,UsName,Content,FileNum,IsGood,IsTop,IsDel,ReplyId,ReStats,AddTime,CentText";
            string sCondition = strWhere;
            string sOrder     = strOrder;
            int    iSCounts   = 0;

            using (SqlDataReader reader = SqlHelper.RunProcedureMe(sTable, sPkey, sField, p_pageIndex, p_pageSize, sCondition, sOrder, iSCounts, out p_recordCount))
            {
                //计算总页数
                if (p_recordCount > 0)
                {
                    int pageCount = BasePage.CalcPageCount(p_recordCount, p_pageSize, ref p_pageIndex);
                }
                else
                {
                    return(listReplys);
                }
                while (reader.Read())
                {
                    BCW.Model.Reply objReply = new BCW.Model.Reply();
                    objReply.ID      = reader.GetInt32(0);
                    objReply.Floor   = reader.GetInt32(1);
                    objReply.ForumId = reader.GetInt32(2);
                    objReply.Bid     = reader.GetInt32(3);
                    objReply.UsID    = reader.GetInt32(4);
                    objReply.UsName  = reader.GetString(5);
                    objReply.Content = reader.GetString(6);
                    objReply.FileNum = reader.GetInt32(7);
                    objReply.IsGood  = reader.GetByte(8);
                    objReply.IsTop   = reader.GetInt32(9);
                    objReply.IsDel   = reader.GetByte(10);
                    objReply.ReplyId = reader.GetInt32(11);
                    if (!reader.IsDBNull(12))
                    {
                        objReply.ReStats = reader.GetString(12);
                    }
                    objReply.AddTime = reader.GetDateTime(13);
                    if (!reader.IsDBNull(14))
                    {
                        objReply.CentText = reader.GetString(14);
                    }

                    listReplys.Add(objReply);
                }
            }
            return(listReplys);
        }
Beispiel #6
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(BCW.Model.Reply model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tb_Reply(");
            strSql.Append("Floor,ForumId,Bid,UsID,UsName,Content,FileNum,IsGood,IsTop,IsDel,ReplyId,AddTime,CentText)");
            strSql.Append(" values (");
            strSql.Append("@Floor,@ForumId,@Bid,@UsID,@UsName,@Content,@FileNum,@IsGood,@IsTop,@IsDel,@ReplyId,@AddTime,@CentText)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Floor",    SqlDbType.Int,         4),
                new SqlParameter("@ForumId",  SqlDbType.Int,         4),
                new SqlParameter("@Bid",      SqlDbType.Int,         4),
                new SqlParameter("@UsID",     SqlDbType.Int,         4),
                new SqlParameter("@UsName",   SqlDbType.NVarChar,   50),
                new SqlParameter("@Content",  SqlDbType.NVarChar,  500),
                new SqlParameter("@FileNum",  SqlDbType.Int,         4),
                new SqlParameter("@IsGood",   SqlDbType.TinyInt,     1),
                new SqlParameter("@IsTop",    SqlDbType.Int,         4),
                new SqlParameter("@IsDel",    SqlDbType.TinyInt,     1),
                new SqlParameter("@ReplyId",  SqlDbType.Int,         4),
                new SqlParameter("@AddTime",  SqlDbType.DateTime),
                new SqlParameter("@CentText", SqlDbType.NVarChar, 50)
            };
            parameters[0].Value  = model.Floor;
            parameters[1].Value  = model.ForumId;
            parameters[2].Value  = model.Bid;
            parameters[3].Value  = model.UsID;
            parameters[4].Value  = model.UsName;
            parameters[5].Value  = model.Content;
            parameters[6].Value  = model.FileNum;
            parameters[7].Value  = 0;
            parameters[8].Value  = 0;
            parameters[9].Value  = 0;
            parameters[10].Value = model.ReplyId;
            parameters[11].Value = model.AddTime;
            parameters[12].Value = model.CentText;

            object obj = SqlHelper.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(1);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Beispiel #7
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public BCW.Model.Reply GetReplyMe(int BID, int Floor)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 UsID,UsName,Content,IsGood,IsTop,CentText,AddTime,ForumId from tb_Reply ");
            strSql.Append(" where BID=@BID ");
            strSql.Append(" and Floor=@Floor ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@BID",   SqlDbType.Int, 4),
                new SqlParameter("@Floor", SqlDbType.Int, 4)
            };
            parameters[0].Value = BID;
            parameters[1].Value = Floor;

            BCW.Model.Reply model = new BCW.Model.Reply();
            using (SqlDataReader reader = SqlHelper.ExecuteReader(strSql.ToString(), parameters))
            {
                if (reader.HasRows)
                {
                    reader.Read();
                    model.UsID    = reader.GetInt32(0);
                    model.UsName  = reader.GetString(1);
                    model.Content = reader.GetString(2);
                    model.IsGood  = reader.GetByte(3);
                    model.IsTop   = reader.GetInt32(4);
                    if (!reader.IsDBNull(5))
                    {
                        model.CentText = reader.GetString(5);
                    }
                    else
                    {
                        model.CentText = "";
                    }
                    model.AddTime = reader.GetDateTime(6);
                    model.ForumId = reader.GetInt32(7);


                    return(model);
                }
                else
                {
                    return(null);
                }
            }
        }
Beispiel #8
0
        public RspAddReplyThread  AddReplyThread(ReqAddReplyThread _reqData)
        {
            RspAddReplyThread _rspData = new RspAddReplyThread();


            //验证用户ID格式
            if (_reqData.userId < 0)
            {
                _rspData.header.status     = ERequestResult.faild;
                _rspData.header.statusCode = Error.MOBILE_ERROR_CODE.MOBILE_PARAMS_ERROR;
                return(_rspData);
            }

            //检查是否登录状态

            if (Common.Common.CheckLogin(_reqData.userId, _reqData.userKey) == 0)
            {
                _rspData.header.status     = ERequestResult.faild;
                _rspData.header.statusCode = Error.MOBILE_ERROR_CODE.SYS_USER_NOLOGIN;
                return(_rspData);
            }

            //检查帖子有效性
            BCW.Model.Text threadModel = new BCW.BLL.Text().GetText(_reqData.threadId);//GetTextMe
            if (threadModel == null)
            {
                _rspData.header.status     = ERequestResult.faild;
                _rspData.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_THREAD_NOT_FOUND;
                return(_rspData);
            }

            //检查自身权限不足
            if (Common.Common.IsUserLimit(BCW.User.Limits.enumRole.Role_Reply, _reqData.userId) == true)
            {
                _rspData.header.status     = ERequestResult.faild;
                _rspData.header.statusCode = Error.MOBILE_ERROR_CODE.SYS_USER_LIMIT_NOT_ENOUGH;
                return(_rspData);
            }

            //板块权限不足
            if (Common.Common.CheckUserFLimit(BCW.User.FLimits.enumRole.Role_Reply, _reqData.userId, threadModel.ForumId))
            {
                _rspData.header.status     = ERequestResult.faild;
                _rspData.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_FORUM_LIMIT_NOT_ENOUGH;
                return(_rspData);
            }


            BCW.Model.Forum Forummodel = new BCW.BLL.Forum().GetForum(threadModel.ForumId);

            //检查圈子访问限制
            Error.MOBILE_ERROR_CODE _groupError = Common.Common.CheckGroupLimit(threadModel.ForumId, _reqData.userId);
            if (_groupError != Error.MOBILE_ERROR_CODE.MOBILE_MSG_NONE)
            {
                _rspData.header.status     = ERequestResult.faild;
                _rspData.header.statusCode = _groupError;
                return(_rspData);
            }

            //检查论坛访问限制
            Error.MOBILE_ERROR_CODE _visitError = Common.Common.ShowForumLimit(_reqData.userId, Forummodel.Gradelt, Forummodel.Visitlt, Forummodel.VisitId, Forummodel.IsPc);
            if (_visitError != Error.MOBILE_ERROR_CODE.MOBILE_MSG_NONE)
            {
                _rspData.header.status     = ERequestResult.faild;
                _rspData.header.statusCode = _visitError;
                return(_rspData);
            }

            //检查论坛回帖限制
            Error.MOBILE_ERROR_CODE _replyError = Common.Common.ShowAddReply(_reqData.userId, Forummodel.Replylt);
            if (_replyError != Error.MOBILE_ERROR_CODE.MOBILE_MSG_NONE)
            {
                _rspData.header.status     = ERequestResult.faild;
                _rspData.header.statusCode = _replyError;
                return(_rspData);
            }

            BCW.Model.Text p = new BCW.BLL.Text().GetText(_reqData.threadId);
            if (p.IsOver == 1)
            {
                _rspData.header.status     = ERequestResult.faild;
                _rspData.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_THREAD_IS_OVER;
                return(_rspData);
            }
            if (p.IsLock == 1)
            {
                _rspData.header.status     = ERequestResult.faild;
                _rspData.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_THREAD_IS_LOCK;
                return(_rspData);
            }
            if (p.IsTop == -1)
            {
                _rspData.header.status     = ERequestResult.faild;
                _rspData.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_THREAD_IS_BOTTOM;
                return(_rspData);
            }

            string Content = _reqData.replyContent;

            if (Regex.IsMatch(Content, @"^[\s\S]{1," + ub.GetSub("BbsReplyMax", xmlPath) + "}$") == false)
            {
                _rspData.header.status     = ERequestResult.faild;
                _rspData.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_THREAD_CONTENT_LENGTH_ERROR;
                _rspData.header.statusMsg  = string.Format(_rspData.header.statusMsg, 1, ub.GetSub("BbsReplyMax", xmlPath));
                return(_rspData);
            }


            int Remind = _reqData.Remind;  //提醒的ID.
            int reid   = _reqData.replyId;


            int ReplyNum = Utils.ParseInt(ub.GetSub("BbsReplyNum", xmlPath));

            if (ReplyNum > 0)
            {
                int ToDayCount = new BCW.BLL.Forumstat().GetCount(_reqData.userId, 2);//今天发布回帖数
                if (ToDayCount >= ReplyNum)
                {
                    _rspData.header.status     = ERequestResult.faild;
                    _rspData.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_THREAD_REPLY_NUM;
                    return(_rspData);
                }
            }

            string mename = new BCW.BLL.User().GetUsName(_reqData.userId);
            int    Floor  = new BCW.BLL.Reply().GetFloor(_reqData.threadId);

            //派币帖
            string CentText = string.Empty;
            string PbCent   = string.Empty;
            int    iTypes   = p.Types;

            if (iTypes == 3)
            {
                BCW.Model.Text model1 = new BCW.BLL.Text().GetText(_reqData.threadId);
                if (p.Prices - p.Pricel > 0)
                {
                    string bzText = string.Empty;
                    if (p.BzType == 0)
                    {
                        bzText = ub.Get("SiteBz");
                    }
                    else
                    {
                        bzText = ub.Get("SiteBz2");
                    }

                    long zPrice = 0;
                    if (p.Price2 > 0)
                    {
                        zPrice = Convert.ToInt64(new Random().Next(p.Price, (p.Price2 + 1)));//随机得到奖币值
                    }
                    else
                    {
                        zPrice = Convert.ToInt64(p.Price);
                    }

                    long GetPrice = 0;
                    if (p.Prices - p.Pricel < zPrice)
                    {
                        GetPrice = p.Prices - p.Pricel;
                    }
                    else
                    {
                        GetPrice = zPrice;
                    }

                    bool a = ("#" + p.IsPriceID + "#").IndexOf("#" + _reqData.userId + "#") == -1;

                    if (p.PayCi == "0")                                //判断派币楼层
                    {
                        if (!string.IsNullOrEmpty(model1.PricesLimit)) //如果要求回复特殊内容
                        {
                            // builder.Append("判断的TF"+a);
                            //  if (model1.PricesLimit.Equals(Content))  //如果回帖正确
                            if (model1.PricesLimit.Replace(" ", "").Equals(Content.Replace(" ", "")))     //如果回复附言正确
                            {
                                if (("#" + p.IsPriceID + "#").IndexOf("#" + _reqData.userId + "#") == -1) //判断是否存在已派币ID
                                {
                                    if (p.BzType == 0)
                                    {
                                        new BCW.BLL.User().UpdateiGold(_reqData.userId, mename, GetPrice, "派币帖回帖获得");
                                    }
                                    else
                                    {
                                        new BCW.BLL.User().UpdateiMoney(_reqData.userId, mename, GetPrice, "派币帖回帖获得");
                                    }

                                    //更新已派
                                    new BCW.BLL.Text().UpdatePricel(_reqData.threadId, GetPrice);
                                    CentText = "" + GetPrice + "" + bzText + "";
                                    PbCent   = "楼主派" + GetPrice + "" + bzText + "";
                                    //更新派币ID
                                    string IsPriceID = p.IsPriceID;
                                    if (("#" + IsPriceID + "#").IndexOf("#" + _reqData.userId + "#") == -1)
                                    {
                                        string sPriceID = string.Empty;
                                        if (string.IsNullOrEmpty(IsPriceID))
                                        {
                                            sPriceID = _reqData.userId.ToString();
                                        }
                                        else
                                        {
                                            sPriceID = IsPriceID + "#" + _reqData.userId;
                                        }
                                        new BCW.BLL.Text().UpdateIsPriceID(_reqData.threadId, sPriceID);
                                    }
                                }
                            }
                        }
                        else //不需要回复内容
                        {
                            //builder.Append("判断的TF" + a);
                            if (("#" + p.IsPriceID + "#").IndexOf("#" + _reqData.userId + "#") == -1)  //判断是否存在已派币ID
                            {
                                if (p.BzType == 0)
                                {
                                    new BCW.BLL.User().UpdateiGold(_reqData.userId, mename, GetPrice, "派币帖回帖获得");
                                }
                                else
                                {
                                    new BCW.BLL.User().UpdateiMoney(_reqData.userId, mename, GetPrice, "派币帖回帖获得");
                                }

                                //更新已派
                                new BCW.BLL.Text().UpdatePricel(_reqData.threadId, GetPrice);
                                CentText = "" + GetPrice + "" + bzText + "";
                                PbCent   = "楼主派" + GetPrice + "" + bzText + "";
                                //更新派币ID
                                string IsPriceID = p.IsPriceID;
                                if (("#" + IsPriceID + "#").IndexOf("#" + _reqData.userId + "#") == -1)
                                {
                                    string sPriceID = string.Empty;
                                    if (string.IsNullOrEmpty(IsPriceID))
                                    {
                                        sPriceID = _reqData.userId.ToString();
                                    }
                                    else
                                    {
                                        sPriceID = IsPriceID + "#" + _reqData.userId;
                                    }
                                    new BCW.BLL.Text().UpdateIsPriceID(_reqData.threadId, sPriceID);
                                }
                            }
                        }
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(model1.PricesLimit))                                             //如果要求回复特殊内容
                        {
                            if (("#" + p.PayCi + "#").IndexOf("#" + Utils.Right(Floor.ToString(), 1) + "#") != -1) //判断要求派币的楼层
                            {
                                if (model1.PricesLimit.Replace(" ", "").Equals(Content.Replace(" ", "")))          //如果回复附言正确
                                                                                                                   // if (model1.PricesLimit.Equals(Content))  //如果回帖正确
                                {
                                    // builder.Append("判断的TF" + a);
                                    //if (("#" + p.IsPriceID + "#").IndexOf("#" + meid + "#") == -1) //判断是否存在已派币ID
                                    //{
                                    if (p.BzType == 0)
                                    {
                                        new BCW.BLL.User().UpdateiGold(_reqData.userId, mename, GetPrice, "派币帖回帖获得");
                                    }
                                    else
                                    {
                                        new BCW.BLL.User().UpdateiMoney(_reqData.userId, mename, GetPrice, "派币帖回帖获得");
                                    }

                                    //更新已派
                                    new BCW.BLL.Text().UpdatePricel(_reqData.threadId, GetPrice);
                                    CentText = "" + GetPrice + "" + bzText + "";
                                    PbCent   = "踩中楼层" + Utils.Right(Floor.ToString(), 1) + "尾,楼主派" + GetPrice + "" + bzText + "";
                                    //更新派币ID
                                    string IsPriceID = p.IsPriceID;
                                    if (("#" + IsPriceID + "#").IndexOf("#" + _reqData.userId + "#") == -1)
                                    {
                                        string sPriceID = string.Empty;
                                        if (string.IsNullOrEmpty(IsPriceID))
                                        {
                                            sPriceID = _reqData.userId.ToString();
                                        }
                                        else
                                        {
                                            sPriceID = IsPriceID + "#" + _reqData.userId;
                                        }
                                        new BCW.BLL.Text().UpdateIsPriceID(_reqData.threadId, sPriceID);
                                    }
                                    //}
                                }
                            }
                        }
                        else //不需要回复内容
                        {
                            if (("#" + p.PayCi + "#").IndexOf("#" + Utils.Right(Floor.ToString(), 1) + "#") != -1)
                            {
                                // builder.Append("判断的TF" + a);
                                //if (("#" + p.IsPriceID + "#").IndexOf("#" + meid + "#") == -1) //判断是否存在已派币ID
                                //{
                                if (p.BzType == 0)
                                {
                                    new BCW.BLL.User().UpdateiGold(_reqData.userId, mename, GetPrice, "派币帖回帖获得");
                                }
                                else
                                {
                                    new BCW.BLL.User().UpdateiMoney(_reqData.userId, mename, GetPrice, "派币帖回帖获得");
                                }
                                //更新已派
                                new BCW.BLL.Text().UpdatePricel(_reqData.threadId, GetPrice);
                                CentText = "" + GetPrice + "" + bzText + "";
                                PbCent   = "踩中楼层" + Utils.Right(Floor.ToString(), 1) + "尾,楼主派" + GetPrice + "" + bzText + "";
                                //更新派币ID
                                string IsPriceID = p.IsPriceID;
                                if (("#" + IsPriceID + "#").IndexOf("#" + _reqData.userId + "#") == -1)
                                {
                                    string sPriceID = string.Empty;
                                    if (string.IsNullOrEmpty(IsPriceID))
                                    {
                                        sPriceID = _reqData.userId.ToString();
                                    }
                                    else
                                    {
                                        sPriceID = IsPriceID + "#" + _reqData.userId;
                                    }
                                    new BCW.BLL.Text().UpdateIsPriceID(_reqData.threadId, sPriceID);
                                }
                                //}
                            }
                        }
                    }
                    //检测15天前的派币帖,如果没有派完则自动清0并自动结帖
                    if (Utils.GetTopDomain().Contains("tuhao") || Utils.GetTopDomain().Contains("th"))
                    {
                        BCW.Data.SqlHelper.ExecuteSql("update tb_Text set Pricel=Prices,IsOver=1 where Types=3 and AddTime<'" + DateTime.Now.AddDays(-15) + "'");
                    }
                    else
                    {
                        BCW.Data.SqlHelper.ExecuteSql("update tb_Text set Pricel=Prices,IsOver=1 where Types=3 and AddTime<'" + DateTime.Now.AddDays(-7) + "'");
                    }
                }
                else
                {
                    //派完币即结帖
                    new BCW.BLL.Text().UpdateIsOver(_reqData.threadId, 1);
                }
            }


            BCW.Model.Reply model = new BCW.Model.Reply();
            model.Floor    = Floor;
            model.ForumId  = threadModel.ForumId;
            model.Bid      = _reqData.threadId;
            model.UsID     = _reqData.userId;
            model.UsName   = mename;
            model.Content  = Content;
            model.FileNum  = 0;
            model.ReplyId  = reid;
            model.AddTime  = DateTime.Now;
            model.CentText = CentText;
            new BCW.BLL.Reply().Add(model);

            //builder.Append("p.IsPriceID=" + p.IsPriceID);

            //更新回复ID
            string sReplyID = p.ReplyID;

            if (("#" + sReplyID + "#").IndexOf("#" + _reqData.userId + "#") == -1)
            {
                string ReplyID = string.Empty;
                if (string.IsNullOrEmpty(sReplyID))
                {
                    ReplyID = _reqData.userId.ToString();
                }
                else
                {
                    ReplyID = sReplyID + "#" + _reqData.userId;
                }
                new BCW.BLL.Text().UpdateReplyID(_reqData.threadId, ReplyID);
            }

            //更新回复数
            new BCW.BLL.Text().UpdateReplyNum(_reqData.threadId, 1);

            //回复提醒:0|不提醒|1|帖子作者|2|回帖作者|3|全部提醒
            string strRemind = string.Empty;
            //提醒费用
            long Tips = Convert.ToInt64(ub.GetSub("BbsReplyTips", xmlPath));

            if (Remind == 1 || Remind == 3)
            {
                if (!p.UsID.Equals(_reqData.userId))
                {
                    string pForumSet = new BCW.BLL.User().GetForumSet(p.UsID);
                    if (BCW.User.Users.GetForumSet(pForumSet, 14) == 0)
                    {
                        if (new BCW.BLL.User().GetGold(_reqData.userId) >= Tips)
                        {
                            new BCW.BLL.Guest().Add(p.UsID, p.UsName, "[url=/bbs/uinfo.aspx?uid=" + _reqData.userId + "]" + mename + "[/url]回复了您的帖子[url=/bbs/topic.aspx?forumid=" + threadModel.ForumId + "&amp;bid=" + _reqData.threadId + "]" + p.Title + "[/url]");
                            if (Tips > 0)
                            {
                                new BCW.BLL.User().UpdateiGold(_reqData.userId, mename, -Tips, "回帖提醒帖子作者");
                            }
                        }
                    }
                    else
                    {
                        strRemind = "帖子作者拒绝接收提醒消息.<br />";
                    }
                }
            }


            if (Remind == 2 || Remind == 3)
            {
                //回帖用户实体
                BCW.Model.Reply m = new BCW.BLL.Reply().GetReplyMe(_reqData.threadId, reid);
                if (!m.UsID.Equals(_reqData.userId))
                {
                    string mForumSet = new BCW.BLL.User().GetForumSet(m.UsID);
                    if (BCW.User.Users.GetForumSet(mForumSet, 14) == 0)
                    {
                        if (new BCW.BLL.User().GetGold(_reqData.userId) >= Tips)
                        {
                            string neirong = new BCW.BLL.Reply().GetContent(_reqData.threadId, reid);
                            if (neirong.Length > 30)
                            {
                                neirong  = neirong.Substring(0, 30);
                                neirong += "...";
                                //builder.Append(":" + neirong);
                            }
                            else
                            {
                                // builder.Append(":" + neirong);
                            }
                            if (Content.Length > 30)
                            {
                                Content  = Content.Substring(0, 30);
                                Content += "...";
                                //builder.Append(":" + neirong);
                            }
                            //  修改这里
                            // builder.Append("<a href=\"" + Utils.getUrl("reply.aspx?act=reply&amp;forumid=" + forumid + "&amp;bid=" + bid + "&amp;reid=" + reid + "&amp;backurl=" + Utils.getPage(0) + "") + "\">点评回复</a>|");
                            new BCW.BLL.Guest().Add(m.UsID, m.UsName, "[url=/bbs/uinfo.aspx?uid=" + _reqData.userId + "]" + mename + "[/url]点评了您的回帖[url=/bbs/reply.aspx?act=view&amp;forumid=" + threadModel.ForumId + "&amp;bid=" + _reqData.threadId + "&amp;reid=" + reid + "]" + reid + "楼[/url]:" + neirong + "<br/>回复内容为:" + Content + "[url=/bbs/reply.aspx?act=view&amp;forumid=" + threadModel.ForumId + "&amp;bid=" + _reqData.threadId + "&amp;reid=" + Floor + "]更多[/url]<br/>[url=/bbs/reply.aspx?act=reply&amp;forumid=" + threadModel.ForumId + "&amp;bid=" + _reqData.threadId + "&amp;reid=" + Floor + "]点评回复[/url]");
                            if (Tips > 0)
                            {
                                new BCW.BLL.User().UpdateiGold(_reqData.userId, mename, -Tips, "回帖提醒回帖作者");
                            }
                        }
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(strRemind))
                        {
                            strRemind = "帖子作者与回帖作者拒绝接收提醒消息.<br />";
                        }
                        else
                        {
                            strRemind = "回帖作者拒绝接收提醒消息.<br />";
                        }
                    }
                }
            }
            //论坛统计
            BCW.User.Users.UpdateForumStat(2, _reqData.userId, mename, threadModel.ForumId);
            //动态记录
            if (Forummodel.GroupId == 0)
            {
                new BCW.BLL.Action().Add(-1, 0, _reqData.userId, mename, "在" + Forummodel.Title + "回复帖子[URL=/bbs/topic.aspx?forumid=" + threadModel.ForumId + "&amp;bid=" + _reqData.threadId + "]" + new BCW.BLL.Text().GetTitle(_reqData.threadId) + "[/URL]");
            }
            else
            {
                new BCW.BLL.Action().Add(-2, 0, _reqData.userId, mename, "在圈坛-" + Forummodel.Title + "回复帖子[URL=/bbs/topic.aspx?forumid=" + threadModel.ForumId + "&amp;bid=" + _reqData.threadId + "]" + new BCW.BLL.Text().GetTitle(_reqData.threadId) + "[/URL]");
            }
            //积分操作/论坛统计/圈子论坛不进行任何奖励
            int IsAcc = -1;

            if (Forummodel.GroupId == 0)
            {
                IsAcc = new BCW.User.Cent().UpdateCent2(BCW.User.Cent.enumRole.Cent_Reply, _reqData.userId, true);
            }
            else
            {
                if (!Utils.GetDomain().Contains("th"))
                {
                    IsAcc = new BCW.User.Cent().UpdateCent2(BCW.User.Cent.enumRole.Cent_Reply, _reqData.userId, false);
                }
            }

            _rspData.header.status = ERequestResult.success;
            if (IsAcc >= 0)
            {
                _rspData.rewardItem = BCW.User.Users.GetWinCent(1, _reqData.userId);
            }

            _rspData.header.status = ERequestResult.success;
            return(_rspData);
        }
Beispiel #9
0
        /// <summary>
        /// 帖子排行分页记录 陈志基 2016/08/10
        /// </summary>
        /// <param name="p_pageIndex">当前页</param>
        /// <param name="p_pageSize">每页显示记录数</param>
        /// <param name="p_recordCount">返回总记录数</param>
        /// <param name="strWhere">查询条件</param>
        /// <returns>List</returns>
        public IList <BCW.Model.Reply> GetForumstats1(int p_pageIndex, int p_pageSize, string strWhere, int showtype, out int p_recordCount)
        {
            IList <BCW.Model.Reply> listForumstat = new List <BCW.Model.Reply>();
            string strWhe = string.Empty;

            if (strWhere != "" || showtype > 1)
            {
                strWhe += " where ";
            }

            if (strWhere != "")
            {
                strWhe += strWhere;
            }

            if (strWhere != "" && showtype > 1)
            {
                strWhe += " and ";
            }

            if (showtype == 2)  //本周
            {
                #region 本周
                string M_Str_mindate = string.Empty;
                switch (DateTime.Now.DayOfWeek)
                {
                case DayOfWeek.Monday:
                    M_Str_mindate = DateTime.Now.AddDays(0).ToShortDateString() + "";
                    break;

                case DayOfWeek.Tuesday:
                    M_Str_mindate = DateTime.Now.AddDays(-1).ToShortDateString() + "";
                    break;

                case DayOfWeek.Wednesday:
                    M_Str_mindate = DateTime.Now.AddDays(-2).ToShortDateString() + "";
                    break;

                case DayOfWeek.Thursday:
                    M_Str_mindate = DateTime.Now.AddDays(-3).ToShortDateString() + "";
                    break;

                case DayOfWeek.Friday:
                    M_Str_mindate = DateTime.Now.AddDays(-4).ToShortDateString() + "";
                    break;

                case DayOfWeek.Saturday:
                    M_Str_mindate = DateTime.Now.AddDays(-5).ToShortDateString() + "";
                    break;

                case DayOfWeek.Sunday:
                    M_Str_mindate = DateTime.Now.AddDays(-6).ToShortDateString() + "";
                    break;
                }
                strWhe += " AddTime>='" + M_Str_mindate + "'";
                #endregion
            }
            else if (showtype == 3) //本月
            {
                #region 本月
                strWhe += " Year(AddTime)=" + DateTime.Now.Year + " and Month(AddTime)=" + DateTime.Now.Month + "";
                #endregion
            }
            else if (showtype == 4) //上月
            {
                #region  月
                DateTime ForDate  = DateTime.Parse(DateTime.Now.AddMonths(-1).ToShortDateString());
                int      ForYear  = ForDate.Year;
                int      ForMonth = ForDate.Month;
                strWhe += " Year(AddTime) = " + (ForYear) + " AND Month(AddTime) = " + (ForMonth) + "";
                #endregion
            }
            else if (showtype == 5) //上周
            {
                #region  周
                DateTime ForDate       = DateTime.Parse(DateTime.Now.AddDays(-7).ToShortDateString());
                string   M_Str_mindate = string.Empty;
                string   M_Str_Maxdate = string.Empty;

                switch (ForDate.DayOfWeek)
                {
                case DayOfWeek.Monday:
                    M_Str_mindate = ForDate.AddDays(0).ToShortDateString() + "";
                    break;

                case DayOfWeek.Tuesday:
                    M_Str_mindate = ForDate.AddDays(-1).ToShortDateString() + "";
                    break;

                case DayOfWeek.Wednesday:
                    M_Str_mindate = ForDate.AddDays(-2).ToShortDateString() + "";
                    break;

                case DayOfWeek.Thursday:
                    M_Str_mindate = ForDate.AddDays(-3).ToShortDateString() + "";
                    break;

                case DayOfWeek.Friday:
                    M_Str_mindate = ForDate.AddDays(-4).ToShortDateString() + "";
                    break;

                case DayOfWeek.Saturday:
                    M_Str_mindate = ForDate.AddDays(-5).ToShortDateString() + "";
                    break;

                case DayOfWeek.Sunday:
                    M_Str_mindate = ForDate.AddDays(-6).ToShortDateString() + "";
                    break;
                }
                M_Str_Maxdate = DateTime.Parse(M_Str_mindate).AddDays(6).ToShortDateString();
                strWhe       += " AddTime between '" + M_Str_mindate + " 00:00:00' AND '" + M_Str_Maxdate + " 23:59:59'";
                #endregion
            }
            strWhe += "  and  IsDel=0 ";
            #region 计算记录数
            // 计算记录数
            string countString = "SELECT COUNT(DISTINCT UsID) FROM tb_Reply " + strWhe + "";
            p_recordCount = Convert.ToInt32(SqlHelper.GetSingle(countString));
            if (p_recordCount > 100)
            {
                p_recordCount = 100;
            }
            if (p_recordCount > 0)
            {
                int pageCount = BasePage.CalcPageCount(p_recordCount, p_pageSize, ref p_pageIndex);
            }
            else
            {
                return(listForumstat);
            }
            #endregion

            #region 取出相关记录数
            // 取出相关记录
            string queryString = "SELECT TOP 100 UsID,COUNT(UsID) FROM tb_Reply " + strWhe + " GROUP BY UsID ORDER BY COUNT(UsID) DESC";

            using (SqlDataReader reader = SqlHelper.ExecuteReader(queryString))
            {
                int stratIndex = (p_pageIndex - 1) * p_pageSize;
                int endIndex   = p_pageIndex * p_pageSize;
                int k          = 0;
                while (reader.Read())
                {
                    if (k >= stratIndex && k < endIndex)
                    {
                        BCW.Model.Reply objForumstat = new BCW.Model.Reply();
                        objForumstat.UsID = reader.GetInt32(0);
                        //objForumstat.UsName = reader.GetString(1);
                        objForumstat.Floor = reader.GetInt32(1);//用ReadNum代替返回值

                        listForumstat.Add(objForumstat);
                    }

                    if (k == endIndex)
                    {
                        break;
                    }

                    k++;
                }
            }
            #endregion

            return(listForumstat);
        }