/** * 复制帖子 | 复制特殊帖、附件等待做。。。 * * @param int $topictype * @return int */ public function run() { foreach ($this->threads as $v) { $topicDm = new PwTopicDm($v['tid']); $topicDm->setLastpost($v['lastpost_userid'], $v['lastpost_username'], $v['lastpost_time'])->setSpecial($v['special'])->setDigest($v['digest'])->setTopped($v['topped'])->setSpecialsort($v['special_sort'])->setTopictype($this->topictype)->setTpcstatus($v['tpcstatus'])->setHighlight($v['highlight'])->setOvertime($v['overtime'])->addHits($v['hits'])->setTitle($v['subject'])->setContent($v['content'])->setFid($this->fid)->setAuthor($v['created_userid'], $v['created_username'], $v['created_ip'])->setModifyInfo($v['modified_userid'], $v['modified_username'], $v['modified_ip'], $v['modified_time'])->setCreatedTime($v['created_time'])->setDisabled($v['disabled'])->setAids($v['aids'])->setIfupload($v['ifupload'])->setReplyNotice($v['reply_notice'])->setLikeCount($v['like_count'])->setSellCount($v['sell_count'])->addReplies($v['replies'])->addSellCount($v['sell_count'])->setReminds($v['reminds'])->setWordVersion($v['word_version'])->setTags($v['tags']); $tid = $this->_getThreadDs()->addThread($topicDm); if ($tid) { PwSimpleHook::getInstance('PwThreadManageDoCopy')->runDo($topicDm, $tid); $forumDm = new PwForumDm($this->fid); $forumDm->addThreads(1); $forumDm->addArticle(1); Wekit::load('SRV:forum.PwForum')->updateForum($forumDm); } } //管理日志添加 Wekit::load('log.srv.PwLogService')->addThreadManageLog($this->srv->user, 'copy', $this->threads, $this->_reason, $this->fid . '|' . $this->topictype); }
/** * 更新版块帖子统计数 * * @param mixed $forum int 版块fid | object PwForumBo * @param int $topic 主题更新数 * @param int $replies 回复更新数 * @param int $tpost 今日发帖更新数 * @param int $lastinfo * @return void */ public function updateStatistics($forum, $topic, $replies, $tpost = 0, $lastinfo = array()) { if (!$forum instanceof PwForumBo) { $forum = new PwForumBo($forum); } if (!$forum->isForum()) { return false; } $article = $topic + $replies; $dm = new PwForumDm($forum->fid); $dm->addThreads($topic)->addPosts($replies)->addArticle($article)->addTodayPosts($tpost); if ($lastinfo) { !isset($lastinfo['time']) && ($lastinfo['time'] = Pw::getTime()); $dm->setLastpostInfo($lastinfo['tid'], Pw::substrs($lastinfo['subject'], 26, 0, true), $lastinfo['username'], $lastinfo['time']); } $service = $this->_getForum(); $service->updateForum($dm, PwForum::FETCH_STATISTICS); if ($fids = $forum->getParentFids()) { $dm = new PwForumDm(true); $dm->addArticle($article)->addSubThreads($topic)->addTodayPosts($tpost); if ($lastinfo && $forum->isOpen()) { $dm->setLastpostInfo($lastinfo['tid'], Pw::substrs($lastinfo['subject'], 26, 0, true), $lastinfo['username'], $lastinfo['time']); } $service->batchUpdateForum($fids, $dm, PwForum::FETCH_STATISTICS); } return true; }