/// <summary> /// 通过待验证的主题 /// </summary> /// <param name="postTableId">当前帖子分表Id</param> /// <param name="tid">主题Id</param> public static void PassAuditNewTopic(string tidList) { string[] tidarray = tidList.Split(','); float[] values = null; ForumInfo forum = null; TopicInfo topic = null; int fid = -1; foreach (string tid in tidarray) { topic = Topics.GetTopicInfo(int.Parse(tid)); //获取主题信息 if (fid != topic.Fid) //当上一个和当前主题不在一个版块内时,重新读取版块的积分设置 { fid = topic.Fid; forum = Discuz.Forum.Forums.GetForumInfo(fid); if (!forum.Postcredits.Equals("")) { int index = 0; float tempval = 0; values = new float[8]; foreach (string ext in Utils.SplitString(forum.Postcredits, ",")) { if (index == 0) { if (!ext.Equals("True")) { values = null; break; } index++; continue; } tempval = Utils.StrToFloat(ext, 0); values[index - 1] = tempval; index++; if (index > 8) { break; } } } } if (values != null) //使用版块内积分 { UserCredits.UpdateUserCreditsByPostTopic(topic.Posterid, values); } else //使用默认积分 { UserCredits.UpdateUserCreditsByPostTopic(topic.Posterid); } } Data.Topics.PassAuditNewTopic(PostTables.GetPostTableId(), tidList); }
/// <summary> /// 通过待验证的主题 /// </summary> /// <param name="postTableId">当前帖子分表Id</param> /// <param name="tid">主题Id</param> public static void PassAuditNewTopic(string tidList) { //string[] tidarray = tidList.Split(','); //float[] values = null; //ForumInfo forum = null; //TopicInfo topic = null; //int fid = -1; foreach (string tid in tidList.Split(',')) { TopicInfo topic = Topics.GetTopicInfo(int.Parse(tid)); //获取主题信息 CreditsFacade.PostTopic(topic.Posterid, Forums.GetForumInfo(topic.Fid)); //if (fid != topic.Fid) //当上一个和当前主题不在一个版块内时,重新读取版块的积分设置 //{ // fid = topic.Fid; // forum = Discuz.Forum.Forums.GetForumInfo(fid); // if (!forum.Postcredits.Equals("")) // { // int index = 0; // float tempval = 0; // values = new float[8]; // foreach (string ext in Utils.SplitString(forum.Postcredits, ",")) // { // if (index == 0) // { // if (!ext.Equals("True")) // { // values = null; // break; // } // index++; // continue; // } // tempval = Utils.StrToFloat(ext, 0); // values[index - 1] = tempval; // index++; // if (index > 8) // { // break; // } // } // } //} //if (values != null) //使用版块内积分 // UserCredits.UpdateUserCreditsByPostTopic(topic.Posterid, values); //else //使用默认积分 // UserCredits.UpdateUserCreditsByPostTopic(topic.Posterid); } Data.Topics.PassAuditNewTopic(PostTables.GetPostTableId(), tidList); }
void IEvent.Execute(object state) { //更新昨日发帖,并更新最高日发帖 Discuz.Data.DatabaseProvider.GetInstance().UpdateYesterdayPosts(PostTables.GetPostTableId()); //更新缓存 Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/Statistics"); //清空onlinetime表的thismonth if (DateTime.Today.Day == 1) { //重置onlinetime表的thismonth(清零) Discuz.Data.DatabaseProvider.GetInstance().ResetThismonthOnlineTime(); //更新统计 Discuz.Data.DatabaseProvider.GetInstance().UpdateStatVars("onlines", "lastupdate", "0"); } }