/// <summary> /// 查看贴子 /// </summary> /// <param name="_reqData"></param> /// <returns></returns> public RspLookThread LookThread(ReqLookThread _reqData) { RspLookThread _rspData = new RspLookThread(); //检查贴子合法性 BCW.Model.Text model = new BCW.BLL.Text().GetText(_reqData.threadId);//GetTextMe if (model == null) { _rspData.header.status = ERequestResult.faild; _rspData.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_THREAD_NOT_FOUND; return(_rspData); } //如果用户已登录,则查看用户是否收藏了该贴 if (_reqData.userId > 0) { _rspData.isFavorites = BCW.Data.SqlHelper.Exists(string.Format("select 1 from tb_Favorites where PUrl like '%bid={0}' and Types=1 and UsID={1}", _reqData.threadId, _reqData.userId)); } new BCW.BLL.Text().UpdateReadNum(model.ID, 1); _rspData.view = model.ReadNum + 1; _rspData.header.status = ERequestResult.success; return(_rspData); }
public RspDelFavorites DelFavorites(ReqDelFavorites _reqData) { RspDelFavorites _rspData = new RspDelFavorites(); //验证用户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 model = new BCW.BLL.Text().GetText(_reqData.userId);//GetTextMe if (model == null) { _rspData.header.status = ERequestResult.faild; _rspData.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_THREAD_NOT_FOUND; return(_rspData); } //是否存在此收藏记录 DataSet _ds = new BCW.BLL.Favorites().GetList("TOP 1 ID", string.Format(" PUrl like '%bid={0}' and Types=1 and UsID={1}", _reqData.threadId, _reqData.userId)); if (_ds == null || _ds.Tables[0].Rows.Count == 0) { _rspData.header.status = ERequestResult.faild; _rspData.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_FAVORITES_NOT_EXISTS; return(_rspData); } int _favoritesId = int.Parse(_ds.Tables[0].Rows[0]["ID"].ToString()); new BCW.BLL.Favorites().Delete(_favoritesId); _rspData.threadId = _reqData.threadId; _rspData.isFavorites = false; _rspData.header.status = ERequestResult.success; return(_rspData); }
public RspDelReply DelReply(ReqDelReply _reqData) { RspDelReply _rspData = new RspDelReply(); //验证用户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 (new BCW.User.ForumInc().IsForum68(threadModel.ForumId) == true) { _rspData.header.status = ERequestResult.faild; _rspData.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_FORUM_FORBID_DEL_REPLY; return(_rspData); } int reid = _reqData.reid; int bid = _reqData.threadId; int meid = _reqData.userId; int forumid = threadModel.ForumId; BCW.Model.Reply model = new BCW.BLL.Reply().GetReplyMe(bid, reid); if (model == null) { _rspData.header.status = ERequestResult.faild; _rspData.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_REPLY_NOT_FOUND; return(_rspData); } if (ub.GetSub("BbsReplyDel", xmlPath) == "0") { if (model.UsID != meid && !new BCW.User.Role().IsUserRole(BCW.User.Role.enumRole.Role_DelReply, meid, forumid)) { _rspData.header.status = ERequestResult.faild; _rspData.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_FORUM_LIMIT_NOT_ENOUGH; return(_rspData); } } else { //检查自身权限 if (!new BCW.User.Role().IsUserRole(BCW.User.Role.enumRole.Role_DelReply, meid, forumid)) { _rspData.header.status = ERequestResult.faild; _rspData.header.statusCode = Error.MOBILE_ERROR_CODE.SYS_USER_LIMIT_NOT_ENOUGH; return(_rspData); } } new BCW.BLL.Reply().UpdateIsDel2(bid, reid, 1); new BCW.BLL.Forumstat().Update2(2, model.UsID, forumid, model.AddTime); //更新统计表发帖 //new BCW.BLL.Reply().Delete(bid, reid); //更新回复数 //new BCW.BLL.Text().UpdateReplyNum(bid, -1); //记录日志 string strLog = string.Empty; if (model.UsID != meid) { //积分操作 int GroupId = new BCW.BLL.Forum().GetGroupId(forumid); if (GroupId == 0) { new BCW.User.Cent().UpdateCent(BCW.User.Cent.enumRole.Cent_DelReply, model.UsID); } strLog = "[url=/bbs/uinfo.aspx?uid=" + model.UsID + "]" + model.UsName + "[/url]的" + reid + "楼回帖被[url=/bbs/uinfo.aspx?uid=" + meid + "]" + new BCW.BLL.User().GetUsName(meid) + "[/url]删除!"; new BCW.BLL.Guest().Add(0, model.UsID, model.UsName, "您的" + reid + "楼回帖被[url=/bbs/uinfo.aspx?uid=" + meid + "]" + new BCW.BLL.User().GetUsName(meid) + "[/url]删除!"); } else { //积分操作 int GroupId = new BCW.BLL.Forum().GetGroupId(forumid); if (GroupId == 0) { new BCW.User.Cent().UpdateCent(BCW.User.Cent.enumRole.Cent_MeDelReply, model.UsID); } strLog = "[url=/bbs/uinfo.aspx?uid=" + model.UsID + "]" + model.UsName + "[/url]删除自己的跟帖"; } new BCW.BLL.Forumlog().Add(6, forumid, bid, reid, strLog); _rspData.header.status = ERequestResult.success; return(_rspData); }
public RspReplyList GetReplyList(ReqReplyList _reqData) { RspReplyList _rspData = new RspReplyList(); _rspData.isFinish = true; //验证用户ID格式 if (_reqData.userId > 0) { 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; //} //检查论坛访问限制 //BCW.Model.Forum Forummodel = new BCW.BLL.Forum().GetForum(threadModel.ForumId); //Error.MOBILE_ERROR_CODE _error = Common.Common.ShowForumLimit(_reqData.userId, Forummodel.Gradelt, Forummodel.Visitlt, Forummodel.VisitId, Forummodel.IsPc); //if (_error != Error.MOBILE_ERROR_CODE.MOBILE_MSG_NONE) //{ // _rspData.header.status = ERequestResult.faild; // _rspData.header.statusCode = _error; // return _rspData; //} //得到帖子类型 int TextUsId = 0; string strWhere = string.Empty; string strOrder = string.Empty; strWhere = " IsDel=0 "; //查询条件 if (_reqData.threadId > 0) { strWhere += " and Bid=" + _reqData.threadId; } switch (_reqData.showType) { case 1: strWhere += " and IsGood=1"; break; case 2: strWhere += " and IsTop=1"; break; case 3: TextUsId = new BCW.BLL.Text().GetUsID(_reqData.threadId); //得到该帖作者 strWhere += " and UsID=" + TextUsId + ""; break; case 4: //预留(热门评论) break; } if (_reqData.authorId > 0) { TextUsId = _reqData.authorId; strWhere += " and UsID=" + TextUsId + ""; } if (_reqData.replyId > 0) { strWhere += " and ID < " + _reqData.replyId + ""; } strOrder = " Order by Istop Desc,AddTime Desc"; // 开始读取列表 DataSet _ds = new BCW.BLL.Reply().GetList(" TOP 10 ID,Floor,UsName,Content,FileNum,ReplyId,AddTime,UsID,IsTop,IsGood,ForumId,Bid ", strWhere + strOrder); if (_ds.Tables[0].Rows.Count > 0) { int k = 1; for (int i = 0; i < _ds.Tables[0].Rows.Count; i++) { RspReplyData _data = new RspReplyData(); _data.id = int.Parse(_ds.Tables[0].Rows[i]["ID"].ToString()); _data.isTop = int.Parse(_ds.Tables[0].Rows[i]["IsTop"].ToString()) == 1; _data.isGood = int.Parse(_ds.Tables[0].Rows[i]["IsGood"].ToString()) == 1; _data.isFile = int.Parse(_ds.Tables[0].Rows[i]["FileNum"].ToString()) > 0; _data.floor = int.Parse(_ds.Tables[0].Rows[i]["Floor"].ToString()); _data.content = BCW.Common.Out.SysUBB(_ds.Tables[0].Rows[i]["Content"].ToString()); _data.ReplyId = int.Parse(_ds.Tables[0].Rows[i]["ReplyId"].ToString()); int _bid = int.Parse(_ds.Tables[0].Rows[i]["Bid"].ToString()); BCW.Model.Reply _replyData = new BCW.BLL.Reply().GetReplyMe(_bid, _data.ReplyId); if (_replyData != null) { _data.replyContent = _data.ReplyId > 0 ? BCW.Common.Out.SysUBB(_replyData.Content) : ""; _data.replyAuthorId = _replyData.UsID; _data.replyAuthorName = _replyData.UsName; _data.replyAddTime = Common.Common.GetLongTime(_replyData.AddTime); } _data.addTime = Common.Common.GetLongTime(System.DateTime.Parse(_ds.Tables[0].Rows[i]["AddTime"].ToString())); _data.praise = 0; _data.authorId = int.Parse(_ds.Tables[0].Rows[i]["UsID"].ToString()); _data.authorName = _ds.Tables[0].Rows[i]["UsName"].ToString(); _data.authorImg = "http://" + Utils.GetDomain() + new BCW.BLL.User().GetPhoto(_data.authorId); _rspData.lstReplyData.Add(_data); //检查是否到底 if (i == _ds.Tables[0].Rows.Count - 1) { if (strWhere.Contains("1=1") == false) { strWhere += " and 1=1"; } DataSet _dsCheck = new BCW.BLL.Reply().GetList(" TOP 10 ID,Floor,UsName,Content,FileNum,ReplyId,AddTime,UsID,IsTop,IsGood,ForumId,Bid ", strWhere.Replace("1=1", "ID<" + _data.id) + strOrder); _rspData.isFinish = _dsCheck.Tables[0].Rows.Count <= 0; _rspData.serverTime = Common.Common.GetLongTime(DateTime.Now); } } } _rspData.header.status = ERequestResult.success; return(_rspData); }
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 + "&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&forumid=" + forumid + "&bid=" + bid + "&reid=" + reid + "&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&forumid=" + threadModel.ForumId + "&bid=" + _reqData.threadId + "&reid=" + reid + "]" + reid + "楼[/url]:" + neirong + "<br/>回复内容为:" + Content + "[url=/bbs/reply.aspx?act=view&forumid=" + threadModel.ForumId + "&bid=" + _reqData.threadId + "&reid=" + Floor + "]更多[/url]<br/>[url=/bbs/reply.aspx?act=reply&forumid=" + threadModel.ForumId + "&bid=" + _reqData.threadId + "&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 + "&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 + "&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); }
/// <summary> /// 获取收藏数据 /// </summary> /// <param name="_reqData"></param> /// <returns></returns> public RspFavoritesList GetFavoritesList(ReqFavoritesList _reqData) { RspFavoritesList _rspData = new RspFavoritesList(); //验证用户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); } //获取动态列表 string strWhere = string.Empty; string strOrder = " order by AddTime desc"; strWhere += "Types=1 and UsId = " + _reqData.userId; if (_reqData.favoritesId > 0) { strWhere += " and ID<" + _reqData.favoritesId; //因为是倒序显示,所以是< } _rspData.isFinish = true; DataSet _ds = new BCW.BLL.Favorites().GetList("TOP 10 ID,Types,NodeId,UsID,Title,PUrl,AddTime", strWhere + strOrder); if (_ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < _ds.Tables[0].Rows.Count; i++) { FavoritesData _favoritesData = new FavoritesData(); _favoritesData.favoritesId = int.Parse(_ds.Tables[0].Rows[i]["ID"].ToString()); string _url = _ds.Tables[0].Rows[i]["PUrl"].ToString(); if (!_url.Contains("bid=")) { continue; } int _threadId = 0; try { //截取ID _threadId = int.Parse(_url.Substring(_url.IndexOf("bid=") + 4)); } catch { continue; } BCW.Model.Text _text = new BCW.BLL.Text().GetText(_threadId); _favoritesData.threadItem = EssencePost.AssembleItem(_text); _rspData.lstFavorites.Add(_favoritesData); //检查是否到底 if (i == _ds.Tables[0].Rows.Count - 1) { if (strWhere.Contains("1=1") == false) { strWhere += " and 1=1"; } DataSet _dsCheck = new BCW.BLL.Favorites().GetList(" TOP 10 ID,Types,NodeId,UsID,Title,PUrl,AddTime ", strWhere.Replace("1=1", "ID<" + _reqData.favoritesId) + strOrder); _rspData.isFinish = _dsCheck.Tables[0].Rows.Count <= 0; } } } _rspData.serverTime = Common.Common.GetLongTime(DateTime.Now); _rspData.header.status = ERequestResult.success; return(_rspData); }
public RspAddFavorites AddFavorites(ReqAddFavorites _reqData) { RspAddFavorites _rspData = new RspAddFavorites(); //验证用户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 model = new BCW.BLL.Text().GetText(_reqData.threadId);//GetTextMe if (model == null) { _rspData.header.status = ERequestResult.faild; _rspData.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_THREAD_NOT_FOUND; return(_rspData); } //是否存在此收藏记录 DataSet _ds = null; _ds = new BCW.BLL.Favorites().GetList("TOP 1 ID", string.Format(" PUrl like '%bid={0}' and Types=1 and UsID={1}", _reqData.threadId, _reqData.userId)); if (_ds != null && _ds.Tables[0].Rows.Count > 0) { _rspData.header.status = ERequestResult.faild; _rspData.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_FAVORITES_EXISTS; return(_rspData); } //如果没有默认收藏夹,先帮其创建一个再进行收藏 int _groupId = 0; _ds = new BCW.BLL.Favgroup().GetList("Top 1 ID,Title", " UsID=" + _reqData.userId + " and Title='默认收藏'"); if (_ds == null || _ds.Tables[0].Rows.Count == 0) { BCW.Model.Favgroup _groupModel = new BCW.Model.Favgroup(); _groupModel.Types = 0; _groupModel.Title = "默认收藏"; _groupModel.UsID = _reqData.userId; _groupModel.Paixu = 0; _groupModel.AddTime = DateTime.Now; _groupId = new BCW.BLL.Favgroup().Add(_groupModel); } else { _groupId = int.Parse(_ds.Tables[0].Rows[0]["ID"].ToString()); } //保存收藏 BCW.Model.Favorites _favoritesModel = new BCW.Model.Favorites(); _favoritesModel.Types = 1; _favoritesModel.NodeId = _groupId; _favoritesModel.UsID = _reqData.userId; _favoritesModel.Title = model.Title; _favoritesModel.PUrl = string.Format("/bbs/topic.aspx?forumid={0}&bid={1}", model.ForumId, _reqData.threadId); _favoritesModel.AddTime = DateTime.Now; int favid = new BCW.BLL.Favorites().Add(_favoritesModel); _rspData.threadId = _reqData.threadId; _rspData.isFavorites = true; _rspData.header.status = ERequestResult.success; return(_rspData); }
public void InitData(int ForumId, int postId, int ptype, int _userId) { this.finish = true; items.Clear(); string strWhere = string.Empty; string strOrder = string.Empty; string[] pageValUrl = { "act", "forumid", "tsid", "ptype", "backurl" }; strWhere = "IsDel=0 and HideType<>9"; if (ptype == 1) { strWhere += " and IsGood=1"; } else if (ptype == 2) { strWhere += " and IsRecom=1"; } if (ptype == 3) { strWhere += " and AddTime>='" + DateTime.Now.AddDays(-2) + "'"; } else if (ptype == 4) { strWhere += " and IsLock=1"; } else if (ptype == 5) { strWhere += " and IsTop=-1"; } if (ForumId > 0) { strWhere += " and ForumId=" + ForumId.ToString(); } if (_userId > 0) { strWhere += " and UsID=" + _userId.ToString(); } if (postId >= 0) { strWhere += " and 1=1"; } //排序条件 if (ForumId > 0 && postId < 0) { strOrder += "IsTop desc,"; } strOrder += "ID Desc"; DataSet _ds = new BCW.BLL.Text().GetList(string.Format("TOP {0} ID,ForumId,Types,LabelId,Title,Content,UsID,UsName,ReplyNum,ReadNum,IsGood,IsRecom,IsLock,IsTop,IsOver,AddTime,Gaddnum,Gwinnum,GoodSmallIcon", RECORD_COUNT), strWhere.Replace("1=1", "ID<" + postId) + " Order by " + strOrder); if (_ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < _ds.Tables[0].Rows.Count; i++) { BCW.Model.Text _textModal = new BCW.BLL.Text().GetText(int.Parse(_ds.Tables[0].Rows[i]["ID"].ToString())); EssencePostItem _essencePostItem = AssembleItem(_textModal); //new EssencePostItem(); //_essencePostItem.threadId = int.Parse(_ds.Tables[0].Rows[i]["ID"].ToString()); //_essencePostItem.authorId = int.Parse(_ds.Tables[0].Rows[i]["UsID"].ToString()); //_essencePostItem.author = _ds.Tables[0].Rows[i]["UsName"].ToString(); //_essencePostItem.authorImg = "http://" + Utils.GetDomain() + new BCW.BLL.User().GetPhoto(int.Parse(_ds.Tables[0].Rows[i]["UsID"].ToString())); //_essencePostItem.forumId = int.Parse(_ds.Tables[0].Rows[i]["ForumId"].ToString()); //_essencePostItem.title = _ds.Tables[0].Rows[i]["Title"].ToString();//.Replace("\\", "\\\\").Replace("\"", "\\\"").Replace("\n", "\\n"); //_essencePostItem.content = Out.SysUBB(_ds.Tables[0].Rows[i]["Content"].ToString());//.Replace("\\", "\\\\").Replace("\"", "\\\"").Replace("\n", "\\n"); //_essencePostItem.ubb_content =_ds.Tables[0].Rows[i]["Content"].ToString(); //_essencePostItem.preview = string.IsNullOrEmpty(_ds.Tables[0].Rows[i]["GoodSmallIcon"].ToString()) ? "http://" + Utils.GetDomain() + "/Files/threadImg/def.png" : _ds.Tables[0].Rows[i]["GoodSmallIcon"].ToString(); //BCW.Model.Forum _forummodel = new BCW.BLL.Forum().GetForum(_essencePostItem.forumId); //_essencePostItem.forum = _forummodel != null ? _forummodel.Title : ""; //_essencePostItem.views = int.Parse(_ds.Tables[0].Rows[i]["ReadNum"].ToString()); //_essencePostItem.replys = int.Parse(_ds.Tables[0].Rows[i]["ReplyNum"].ToString()); //System.DateTime _startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1)); //_essencePostItem.addTime = (long)(DateTime.Parse(_ds.Tables[0].Rows[i]["AddTime"].ToString()) - _startTime).TotalSeconds; ////打赏 //DataSet _dsCent = new BCW.BLL.Textcent().GetList("isnull(SUM(Cents),0)cents", "BID='" + _essencePostItem.threadId + "'"); //_essencePostItem.likes = int.Parse(_dsCent.Tables[0].Rows[0]["cents"].ToString()); //_essencePostItem.IsGood = int.Parse(_ds.Tables[0].Rows[i]["IsGood"].ToString()); //_essencePostItem.IsRecom = int.Parse(_ds.Tables[0].Rows[i]["IsRecom"].ToString()); //_essencePostItem.IsLock = int.Parse(_ds.Tables[0].Rows[i]["IsLock"].ToString()); //_essencePostItem.IsTop = int.Parse(_ds.Tables[0].Rows[i]["IsTop"].ToString()); items.Add(_essencePostItem); //检查是否到底 if (i == _ds.Tables[0].Rows.Count - 1) { if (strWhere.Contains("1=1") == false) { strWhere += " and 1=1"; } DataSet _dsCheck = new BCW.BLL.Text().GetList("TOP 1 * ", strWhere.Replace("1=1", "ID<" + _essencePostItem.threadId) + " Order by " + strOrder); finish = _dsCheck.Tables[0].Rows.Count <= 0; } } } }
/// <summary> /// 设置精华贴 /// </summary> /// <param name="_reqData"></param> /// <returns></returns> public RspGoodThread SetGoodThread(ReqGoodThread _reqData) { RspGoodThread _rspGoodThread = new RspGoodThread(); int uid = _reqData.userId; int bid = _reqData.threadId; //检查是否登录状态 if (Common.Common.CheckLogin(uid, _reqData.userKey) == 0) { _rspGoodThread.header.status = ERequestResult.faild; _rspGoodThread.header.statusCode = Error.MOBILE_ERROR_CODE.SYS_USER_NOLOGIN; return(_rspGoodThread); } BCW.Model.Text model = new BCW.BLL.Text().GetText(bid);//GetTextMe if (model == null) { _rspGoodThread.header.status = ERequestResult.faild; _rspGoodThread.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_THREAD_NOT_FOUND; return(_rspGoodThread); } string sText = string.Empty; if (_reqData.goodType == 1) { sText = "加为"; } else { sText = "解除"; } int IsGood = new BCW.BLL.Text().GetIsGood(bid); if (_reqData.goodType == 1 && IsGood == 1) { _rspGoodThread.header.status = ERequestResult.faild; _rspGoodThread.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_THREAD_IS_GOOD; return(_rspGoodThread); } //不能操作自己的 if (uid == model.UsID) { _rspGoodThread.header.status = ERequestResult.faild; _rspGoodThread.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_THREAD_OPER_MYSELF; return(_rspGoodThread); } //积分操作/论坛统计/圈子论坛不进行任何奖励 int GroupId = new BCW.BLL.Forum().GetGroupId(model.ForumId); if (GroupId == 0) { //检查权限 if (_reqData.goodType == 1 && new BCW.User.Role().IsUserRole(BCW.User.Role.enumRole.Role_GoodText, uid, model.ForumId) == false) { _rspGoodThread.header.status = ERequestResult.faild; _rspGoodThread.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_FORUM_LIMIT_NOT_ENOUGH; return(_rspGoodThread); } else if (_reqData.goodType == 0 && new BCW.User.Role().IsUserRole(BCW.User.Role.enumRole.Role_DelGoodText, uid, model.ForumId) == false) { _rspGoodThread.header.status = ERequestResult.faild; _rspGoodThread.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_FORUM_LIMIT_NOT_ENOUGH; return(_rspGoodThread); } } string strLog = "主题[url=/bbs/topic.aspx?forumid=" + model.ForumId + "&bid=" + bid + "]《" + model.Title + "》[/url]被[url=/bbs/uinfo.aspx?uid=" + uid + "]" + new BCW.BLL.User().GetUsName(uid) + "[/url]" + sText + "精华!"; new BCW.BLL.Text().UpdateIsGood(bid, _reqData.goodType); new BCW.BLL.Forumlog().Add(1, model.ForumId, bid, "[url=/bbs/uinfo.aspx?uid=" + model.UsID + "]" + model.UsName + "[/url]的" + strLog); new BCW.BLL.Guest().Add(0, model.UsID, model.UsName, "您的" + strLog); _rspGoodThread.header.status = ERequestResult.success; return(_rspGoodThread); }
/// <summary> /// 置顶帖子 /// </summary> /// <param name="_reqData"></param> /// <returns></returns> public RspTopThread SetTopThread(ReqTopThread _reqData) { RspTopThread _rspTopThread = new RspTopThread(); int uid = _reqData.userId; int bid = _reqData.threadId; //检查是否登录状态 if (Common.Common.CheckLogin(uid, _reqData.userKey) == 0) { _rspTopThread.header.status = ERequestResult.faild; _rspTopThread.header.statusCode = Error.MOBILE_ERROR_CODE.SYS_USER_NOLOGIN; return(_rspTopThread); } BCW.Model.Text model = new BCW.BLL.Text().GetText(bid);//GetTextMe if (model == null) { _rspTopThread.header.status = ERequestResult.faild; _rspTopThread.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_THREAD_NOT_FOUND; return(_rspTopThread); } //是否总版权限 bool IsSuper = new BCW.User.Role().IsUserRole(BCW.User.Role.enumRole.Role_TopText, uid); string sText = string.Empty; if (_reqData.topType > 0) { sText = "设置"; } else { sText = "去掉"; } //得到置顶类型 int threadTopType = new BCW.BLL.Text().GetIsTop(bid); if (_reqData.topType == 1) //版内置顶 { //是否有置顶权限 if (IsSuper == false && new BCW.User.Role().IsUserRole(BCW.User.Role.enumRole.Role_TopText, uid, model.ForumId) == false) { _rspTopThread.header.status = ERequestResult.faild; _rspTopThread.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_FORUM_LIMIT_NOT_ENOUGH; return(_rspTopThread); } if (threadTopType > 0) { _rspTopThread.header.status = ERequestResult.faild; _rspTopThread.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_THREAD_IS_TOP; return(_rspTopThread); } new BCW.BLL.Text().UpdateIsTop(bid, 1); } else if (_reqData.topType == 2) //全区置顶 { if (threadTopType == 2) { _rspTopThread.header.status = ERequestResult.faild; _rspTopThread.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_THREAD_IS_TOP; return(_rspTopThread); } if (!IsSuper) { _rspTopThread.header.status = ERequestResult.faild; _rspTopThread.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_FORUM_LIMIT_NOT_ENOUGH; return(_rspTopThread); } new BCW.BLL.Text().UpdateIsTop(bid, 2); sText = "设置全版区"; } else //取消置顶 { if (threadTopType == 2 && IsSuper == false) { _rspTopThread.header.status = ERequestResult.faild; _rspTopThread.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_FORUM_LIMIT_NOT_ENOUGH; return(_rspTopThread); } if (_reqData.topType == 2) { sText = "去掉全版区"; } new BCW.BLL.Text().UpdateIsTop(bid, 0); } //加币与扣币(无) //记录日志 string strLog = "主题[url=/bbs/topic.aspx?forumid=" + model.ForumId + "&bid=" + bid + "]《" + model.Title + "》[/url]被[url=/bbs/uinfo.aspx?uid=" + uid + "]" + new BCW.BLL.User().GetUsName(uid) + "[/url]" + sText + "置顶!"; new BCW.BLL.Forumlog().Add(3, model.ForumId, bid, "[url=/bbs/uinfo.aspx?uid=" + model.UsID + "]" + model.UsName + "[/url]的" + strLog); new BCW.BLL.Guest().Add(0, model.UsID, model.UsName, "您的" + strLog); _rspTopThread.header.status = ERequestResult.success; return(_rspTopThread); }
/// <summary> /// 删除帖子 /// </summary> /// <param name="_reqData"></param> /// <returns></returns> public RspDelThread DelThread(ReqDelThread _reqData) { RspDelThread _rspdelThread = new RspDelThread(); int uid = _reqData.userId; int bid = _reqData.threadId; //检查是否登录状态 if (Common.Common.CheckLogin(uid, _reqData.userKey) == 0) { _rspdelThread.header.status = ERequestResult.faild; _rspdelThread.header.statusCode = Error.MOBILE_ERROR_CODE.SYS_USER_NOLOGIN; return(_rspdelThread); } BCW.Model.Text model = new BCW.BLL.Text().GetText(bid);//GetTextMe if (model == null) { _rspdelThread.header.status = ERequestResult.faild; _rspdelThread.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_THREAD_NOT_FOUND; return(_rspdelThread); } int forumid = model.ForumId; if (ub.GetSub("BbsThreadDel", xmlPath) == "0") { if (model.UsID != _reqData.userId && new BCW.User.Role().IsUserRole(BCW.User.Role.enumRole.Role_DelText, uid, model.ForumId) == false) { _rspdelThread.header.status = ERequestResult.faild; _rspdelThread.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_FORUM_LIMIT_NOT_ENOUGH; return(_rspdelThread); } } else { if (new BCW.User.Role().IsUserRole(BCW.User.Role.enumRole.Role_DelText, uid, forumid) == false) { _rspdelThread.header.status = ERequestResult.faild; _rspdelThread.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_FORUM_LIMIT_NOT_ENOUGH; return(_rspdelThread); } } if (model.IsGood == 1) { _rspdelThread.header.status = ERequestResult.faild; _rspdelThread.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_THREAD_IS_GOOD; return(_rspdelThread); } if (model.IsRecom == 1) { _rspdelThread.header.status = ERequestResult.faild; _rspdelThread.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_THREAD_IS_RECOM; return(_rspdelThread); } if (model.IsLock == 1) { _rspdelThread.header.status = ERequestResult.faild; _rspdelThread.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_THREAD_IS_LOCK; return(_rspdelThread); } if (model.IsTop == -1) { _rspdelThread.header.status = ERequestResult.faild; _rspdelThread.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_THREAD_IS_TOP; return(_rspdelThread); } if (model.ForumId == 1) { _rspdelThread.header.status = ERequestResult.faild; _rspdelThread.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_THREAD_DEL_FORBID; return(_rspdelThread); } new BCW.BLL.Text().UpdateIsDel(bid, 1); new BCW.BLL.Forumstat().Update2(1, model.UsID, forumid, model.AddTime); //更新统计表发帖 DataSet ds = new BCW.BLL.Reply().GetList("ID,AddTime,UsID,IsDel", "forumid=" + forumid + " and bid=" + bid + ""); //更新统计表回帖 { if (ds != null && ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { if (int.Parse(ds.Tables[0].Rows[i]["IsDel"].ToString()) == 0)//如果回帖没有删除 { new BCW.BLL.Forumstat().Update2(2, int.Parse(ds.Tables[0].Rows[i]["UsID"].ToString()), forumid, DateTime.Parse(ds.Tables[0].Rows[i]["AddTime"].ToString())); } } } } new BCW.BLL.Reply().UpdateIsDel(bid, 1); //记录日志 string strLog = string.Empty; if (model.UsID != uid) { //积分操作 new BCW.User.Cent().UpdateCent(BCW.User.Cent.enumRole.Cent_DelText, model.UsID); strLog = "[url=/bbs/uinfo.aspx?uid=" + model.UsID + "]" + model.UsName + "[/url]的主题《" + model.Title + "》被[url=/bbs/uinfo.aspx?uid=" + uid + "]" + new BCW.BLL.User().GetUsName(uid) + "[/url]删除!"; new BCW.BLL.Guest().Add(0, model.UsID, model.UsName, "您的主题《" + model.Title + "》被[url=/bbs/uinfo.aspx?uid=" + uid + "]" + new BCW.BLL.User().GetUsName(uid) + "[/url]删除!"); } else { //积分操作 new BCW.User.Cent().UpdateCent(BCW.User.Cent.enumRole.Cent_MeDelText, model.UsID); strLog = "[url=/bbs/uinfo.aspx?uid=" + model.UsID + "]" + model.UsName + "[/url]删除自己的主题《" + model.Title + "》"; } new BCW.BLL.Forumlog().Add(6, forumid, strLog); _rspdelThread.header.status = ERequestResult.success; return(_rspdelThread); }
/// <summary> /// 编辑帖子 /// </summary> /// <param name="_reqData"></param> /// <returns></returns> public RspEditThread EditThread(ReqEditThread _reqData) { RspEditThread _rspEditThread = new RspEditThread(); //验证用户ID格式 if (_reqData.userId < 0) { _rspEditThread.header.status = ERequestResult.faild; _rspEditThread.header.statusCode = Error.MOBILE_ERROR_CODE.MOBILE_PARAMS_ERROR; return(_rspEditThread); } //验证贴子标题长度 if (Regex.IsMatch(_reqData.title, @"^[\s\S]{" + ub.GetSub("BbsThreadMin", xmlPath) + "," + ub.GetSub("BbsThreadMax", xmlPath) + "}$") == false) { _rspEditThread.header.status = ERequestResult.faild; _rspEditThread.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_THREAD_TITLE_LENGTH_ERROR; _rspEditThread.header.statusMsg = string.Format(_rspEditThread.header.statusMsg, ub.GetSub("BbsThreadMin", xmlPath), ub.GetSub("BbsThreadMax", xmlPath)); return(_rspEditThread); } //验证内容长度 if (Regex.IsMatch(_reqData.content, @"^[\s\S]{" + ub.GetSub("BbsContentMin", xmlPath) + "," + ub.GetSub("BbsContentMax", xmlPath) + "}$") == false) { _rspEditThread.header.status = ERequestResult.faild; _rspEditThread.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_THREAD_CONTENT_LENGTH_ERROR; _rspEditThread.header.statusMsg = string.Format(_rspEditThread.header.statusMsg, ub.GetSub("BbsContentMin", xmlPath), ub.GetSub("BbsContentMax", xmlPath)); return(_rspEditThread); } //检查是否登录状态 if (Common.Common.CheckLogin(_reqData.userId, _reqData.userKey) == 0) { _rspEditThread.header.status = ERequestResult.faild; _rspEditThread.header.statusCode = Error.MOBILE_ERROR_CODE.SYS_USER_NOLOGIN; return(_rspEditThread); } BCW.Model.Text model = new BCW.BLL.Text().GetText(_reqData.threadId); if (model == null) { _rspEditThread.header.status = ERequestResult.faild; _rspEditThread.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_THREAD_NOT_FOUND; return(_rspEditThread); } if (model.UsID != _reqData.userId && new BCW.User.Role().IsUserRole(BCW.User.Role.enumRole.Role_EditText, _reqData.userId, model.ForumId) == false) { _rspEditThread.header.status = ERequestResult.faild; _rspEditThread.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_FORUM_LIMIT_NOT_ENOUGH; return(_rspEditThread); } if (model.IsLock == 1) { _rspEditThread.header.status = ERequestResult.faild; _rspEditThread.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_THREAD_IS_LOCK; return(_rspEditThread); } if (model.IsTop == -1) { _rspEditThread.header.status = ERequestResult.faild; _rspEditThread.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_THREAD_IS_TOP; return(_rspEditThread); } BCW.Model.Text model2 = new BCW.Model.Text(); model2.ID = _reqData.threadId; model2.Title = _reqData.title; model2.Content = _reqData.content; new BCW.BLL.Text().Update(model2); //记录日志 string strLog = string.Empty; if (model.UsID != _reqData.userId) { strLog = "[url=/bbs/uinfo.aspx?uid=" + model.UsID + "]" + model.UsName + "[/url]的主题[url=/bbs/topic.aspx?forumid=" + model.ForumId + "&bid=" + _reqData.threadId + "]《" + model.Title + "》[/url]被[url=/bbs/uinfo.aspx?uid=" + _reqData.userId + "]" + new BCW.BLL.User().GetUsName(_reqData.userId) + "[/url]编辑!"; new BCW.BLL.Guest().Add(0, model.UsID, model.UsName, "您的主题[url=/bbs/topic.aspx?forumid=" + model.ForumId + "&bid=" + _reqData.threadId + "]《" + model.Title + "》[/url]被[url=/bbs/uinfo.aspx?uid=" + _reqData.userId + "]" + new BCW.BLL.User().GetUsName(_reqData.userId) + "[/url]编辑!"); } else { strLog = "[url=/bbs/uinfo.aspx?uid=" + model.UsID + "]" + model.UsName + "[/url]编辑自己的主题[url=/bbs/topic.aspx?forumid=" + model.ForumId + "&bid=" + _reqData.threadId + "]《" + model.Title + "》[/url]!"; } new BCW.BLL.Forumlog().Add(7, model.ForumId, _reqData.threadId, strLog); _rspEditThread.header.status = ERequestResult.success; _rspEditThread.threadId = _reqData.threadId; return(_rspEditThread); }
/// <summary> /// 发贴 /// </summary> /// <param name="ForumId"></param> /// <returns>发表贴子结果类</returns> public RspAddThread AddThread(ReqAddThread _reqData) { RspAddThread _rspAddThread = new RspAddThread(); //验证用户ID格式 if (_reqData.userId < 0) { _rspAddThread.header.status = ERequestResult.faild; _rspAddThread.header.statusCode = Error.MOBILE_ERROR_CODE.MOBILE_PARAMS_ERROR; return(_rspAddThread); } //验证帖子类型 if (Regex.IsMatch(_reqData.pType.ToString(), @"^[0-4]$|^6$|^7$|^8$") == false) { _rspAddThread.header.status = ERequestResult.faild; _rspAddThread.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_THREAD_TYPE_ERROR; return(_rspAddThread); } //验证帖子类型 if (Regex.IsMatch(_reqData.forumId.ToString(), @"^[0-9]\d*$") == false) { _rspAddThread.header.status = ERequestResult.faild; _rspAddThread.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_THREAD_TYPE_ERROR; return(_rspAddThread); } //验证贴子标题长度 if (Regex.IsMatch(_reqData.title, @"^[\s\S]{" + ub.GetSub("BbsThreadMin", xmlPath) + "," + ub.GetSub("BbsThreadMax", xmlPath) + "}$") == false) { _rspAddThread.header.status = ERequestResult.faild; _rspAddThread.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_THREAD_TITLE_LENGTH_ERROR; _rspAddThread.header.statusMsg = string.Format(_rspAddThread.header.statusMsg, ub.GetSub("BbsThreadMin", xmlPath), ub.GetSub("BbsThreadMax", xmlPath)); return(_rspAddThread); } //验证内容长度 if (Regex.IsMatch(_reqData.content, @"^[\s\S]{" + ub.GetSub("BbsContentMin", xmlPath) + "," + ub.GetSub("BbsContentMax", xmlPath) + "}$") == false) { _rspAddThread.header.status = ERequestResult.faild; _rspAddThread.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_THREAD_CONTENT_LENGTH_ERROR; _rspAddThread.header.statusMsg = string.Format(_rspAddThread.header.statusMsg, ub.GetSub("BbsContentMin", xmlPath), ub.GetSub("BbsContentMax", xmlPath)); return(_rspAddThread); } //检查是否登录状态 if (Common.Common.CheckLogin(_reqData.userId, _reqData.userKey) == 0) { _rspAddThread.header.status = ERequestResult.faild; _rspAddThread.header.statusCode = Error.MOBILE_ERROR_CODE.SYS_USER_NOLOGIN; return(_rspAddThread); } //版块是否可用 if (!new BCW.BLL.Forum().Exists2(_reqData.forumId)) { _rspAddThread.header.status = ERequestResult.faild; _rspAddThread.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_FORUM_NOT_FOUND; return(_rspAddThread); } //自身权限不足 if (new BCW.User.Limits().IsUserLimit(BCW.User.Limits.enumRole.Role_Text, _reqData.userId) == true) { _rspAddThread.header.status = ERequestResult.faild; _rspAddThread.header.statusCode = Error.MOBILE_ERROR_CODE.SYS_USER_LIMIT_NOT_ENOUGH; return(_rspAddThread); } //板块权限不足 if (Common.Common.CheckUserFLimit(BCW.User.FLimits.enumRole.Role_Text, _reqData.userId, _reqData.forumId)) { _rspAddThread.header.status = ERequestResult.faild; _rspAddThread.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_FORUM_LIMIT_NOT_ENOUGH; return(_rspAddThread); } string mename = new BCW.BLL.User().GetUsName(_reqData.userId); int ThreadNum = Utils.ParseInt(ub.GetSub("BbsThreadNum", xmlPath)); if (ThreadNum > 0) { int ToDayCount = new BCW.BLL.Forumstat().GetCount(_reqData.userId, 1);//今天发布帖子数 if (ToDayCount >= ThreadNum) { _rspAddThread.header.status = ERequestResult.faild; _rspAddThread.header.statusCode = Error.MOBILE_ERROR_CODE.BBS_THREAD_THREAD_NUM; return(_rspAddThread); } } BCW.Model.Forum model = new BCW.BLL.Forum().GetForum(_reqData.forumId); //论坛限制性 //BCW.User.Users.ShowForumLimit(_reqData.userId, model.Gradelt, model.Visitlt, model.VisitId, model.IsPc); //浏览限制 //发贴限制 Error.MOBILE_ERROR_CODE _result = Common.Common.ShowAddThread(_reqData.userId, model.Postlt); if (_result != Error.MOBILE_ERROR_CODE.MOBILE_MSG_NONE) { _rspAddThread.header.status = ERequestResult.faild; _rspAddThread.header.statusCode = _result; return(_rspAddThread); } //判断玩家是否刷屏 string Hide = string.Empty; int Price = 0; int Price2 = 0; long Prices = 0; int BzType = 0; int HideType = 0; int IsSeen = 0; string PayCi = string.Empty; string Vote = string.Empty; DateTime VoteExTime = DateTime.Now; int LabelId = 0; BCW.Model.Text addmodel = new BCW.Model.Text(); addmodel.ForumId = _reqData.forumId; addmodel.Types = _reqData.pType; addmodel.LabelId = LabelId; addmodel.Title = _reqData.title; addmodel.Content = _reqData.content; addmodel.HideContent = Hide; addmodel.UsID = _reqData.userId; addmodel.UsName = mename; addmodel.Price = Price; addmodel.Price2 = Price2; addmodel.Prices = Prices; addmodel.HideType = HideType; addmodel.BzType = BzType; addmodel.PayCi = PayCi; addmodel.IsSeen = IsSeen; addmodel.IsDel = 0; addmodel.AddTime = DateTime.Now; addmodel.ReTime = DateTime.Now; addmodel.PricesLimit = ""; addmodel.Gaddnum = 0; addmodel.Gqinum = 0; int k = 0; k = new BCW.BLL.Text().Add(addmodel); //论坛统计 BCW.User.Users.UpdateForumStat(1, _reqData.userId, mename, _reqData.forumId); //动态记录 if (model.GroupId > 0) { new BCW.BLL.Action().Add(-2, 0, _reqData.userId, mename, "在圈坛-" + model.Title + "发表了[URL=/bbs/topic.aspx?forumid=" + _reqData.forumId + "&bid=" + k + "]" + _reqData.title + "[/URL]的帖子"); } else { new BCW.BLL.Action().Add(-1, 0, _reqData.userId, mename, "在" + model.Title + "发表了[URL=/bbs/topic.aspx?forumid=" + _reqData.forumId + "&bid=" + k + "]" + _reqData.title + "[/URL]的帖子"); } //积分操作/论坛统计/圈子论坛不进行任何奖励 int GroupId = new BCW.BLL.Forum().GetGroupId(_reqData.forumId); int IsAcc = -1; if (GroupId == 0) { IsAcc = new BCW.User.Cent().UpdateCent2(BCW.User.Cent.enumRole.Cent_Text, _reqData.userId, true); } else { if (!Utils.GetDomain().Contains("th")) { IsAcc = new BCW.User.Cent().UpdateCent2(BCW.User.Cent.enumRole.Cent_Text, _reqData.userId, false); } } #region 这里开始修改提醒ID 发内线 string remind = ub.GetSub("remindid" + _reqData.forumId, xmlPath); //获取XML的值 if (remind != "") //如果有提醒ID { string[] IDS = remind.Split('#'); for (int i = 0; i < IDS.Length; i++) { if (model.GroupId > 0) { new BCW.BLL.Guest().Add(0, int.Parse(IDS[i]), new BCW.BLL.User().GetUsName(int.Parse(IDS[i])), "请注意!用户[url=/bbs/uinfo.aspx?uid=" + _reqData.userId + "]" + mename + "(" + _reqData.userId + ")[/url]在圈坛-" + model.Title + "发表了[URL=/bbs/topic.aspx?forumid=" + _reqData.forumId + "&bid=" + k + "]" + _reqData.title + "[/URL]的帖子"); } else { new BCW.BLL.Guest().Add(0, int.Parse(IDS[i]), new BCW.BLL.User().GetUsName(int.Parse(IDS[i])), "请注意!用户[url=/bbs/uinfo.aspx?uid=" + _reqData.userId + "]" + mename + "(" + _reqData.userId + ")[/url]在" + model.Title + "发表了[URL=/bbs/topic.aspx?forumid=" + _reqData.forumId + "&bid=" + k + "]" + _reqData.title + "[/URL]的帖子"); } } } #endregion _rspAddThread.header.status = ERequestResult.success; _rspAddThread.threadId = k; return(_rspAddThread); }