/** * 重新统计所有版块的帖子数 */ public function countAllForumStatistics() { $forums = $this->_getForum()->getForumOrderByType(false); $fids = array_keys($forums); Wind::import('SRV:forum.dm.PwForumDm'); $dm = new PwForumDm(true); $dm->setThreads(0)->setPosts(0)->setArticle(0)->setSubThreads(0); $this->_getForum()->batchUpdateForum($fids, $dm, PwForum::FETCH_STATISTICS); $threads = Wekit::load('forum.PwThreadExpand')->countThreadsByFid(); $posts = Wekit::load('forum.PwThreadExpand')->countPostsByFid(); foreach ($fids as $key => $value) { if (!isset($threads[$value]) && !isset($posts[$value])) { continue; } $dm = new PwForumDm($value); $dm->setThreads($threads[$value]['sum'])->setPosts($posts[$value]['sum']); $this->_getForum()->updateForum($dm, PwForum::FETCH_STATISTICS); } foreach ($fids as $key => $value) { $this->_getForum()->updateForumStatistics($value); } }