/// <summary> /// 移动主题到指定版块 /// </summary> /// <param name="topiclist">要移动的主题列表</param> /// <param name="fid">转到的版块ID</param> /// <returns>更新记录数</returns> public static int MoveTopics(string topiclist, int fid, int oldfid, int topicType) { if (!Utils.IsNumericList(topiclist)) { return(-1); } //更新帖子 foreach (string tid in topiclist.Split(',')) { DatabaseProvider.GetInstance().UpdatePost(topiclist, fid, PostTables.GetPostTableName(TypeConverter.StrToInt(tid))); } //更新主题 int reval = Discuz.Data.Topics.UpdateTopic(topiclist, fid, topicType); if (reval > 0) { AdminForumStats.ReSetFourmTopicAPost(fid); AdminForumStats.ReSetFourmTopicAPost(oldfid); Forums.SetRealCurrentTopics(fid); Forums.SetRealCurrentTopics(oldfid); } //生成置顶帖 ResetTopTopicList(); return(reval); }
/// <summary> /// 移动主题到指定版块 /// </summary> /// <param name="topiclist">要移动的主题列表</param> /// <param name="fid">转到的版块ID</param> /// <param name="savelink">是否在原版块保留连接</param> /// <returns>更新记录数</returns> public static int MoveTopics(string topiclist, int fid, int oldfid, bool savelink, int topicType) { if (!Utils.IsNumericList(topiclist)) { return(-1); } Discuz.Data.TopicAdmins.DeleteClosedTopics(fid, topiclist); //转移帖子 MoveTopics(topiclist, fid, oldfid, topicType); //如果保存链接则复制一条记录到原版块 if (savelink) { if (Discuz.Data.TopicAdmins.CopyTopicLink(oldfid, topiclist) <= 0) { return(-2); } AdminForumStats.ReSetFourmTopicAPost(oldfid); Forums.SetRealCurrentTopics(oldfid); } return(1); }
/// <summary> /// 移动主题到指定版块 /// </summary> /// <param name="topiclist">要移动的主题列表</param> /// <param name="fid">转到的版块ID</param> /// <param name="savelink">是否在原版块保留连接</param> /// <returns>更新记录数</returns> public static int MoveTopics(string topiclist, int fid, int oldfid, bool savelink, int topicType) { if (!Utils.IsNumericList(topiclist)) { return(-1); } string tidList = ""; DataTable dt = Topics.GetTopicList(topiclist); foreach (DataRow dr in dt.Rows) { if (TypeConverter.ObjectToInt(dr["closed"]) <= 1 || TypeConverter.ObjectToInt(dr["fid"]) != oldfid) { tidList += dr["tid"].ToString() + ","; } } tidList = tidList.TrimEnd(','); if (string.IsNullOrEmpty(tidList)) { return(-1); } Discuz.Data.TopicAdmins.DeleteClosedTopics(fid, tidList); //转移帖子 MoveTopics(tidList, fid, oldfid, topicType); //如果保存链接则复制一条记录到原版块 if (savelink) { if (Discuz.Data.TopicAdmins.CopyTopicLink(oldfid, tidList) <= 0) { return(-2); } AdminForumStats.ReSetFourmTopicAPost(oldfid); Forums.SetRealCurrentTopics(oldfid); } return(1); }