/** * 复制帖子 | 复制特殊帖、附件等待做。。。 * * @param int $topictype * @return int */ public function run() { $threads = Wekit::load('forum.PwThread')->fetchThread($this->tids); $topicDm = new PwTopicDm(true); $topicDm->setTopictype($this->topictype)->setFid($this->fid); $this->_getThreadDs()->batchUpdateThread(array_keys($threads), $topicDm, PwThread::FETCH_MAIN); $this->_getAttachDs()->batchUpdateFidByTid($this->tids, $this->fid); $fids = array(); foreach ($threads as $t) { if ($t['fid'] == $this->fid) { continue; } $fids[$t['fid']]['thread'] -= 1; $fids[$t['fid']]['replies'] -= $t['replies']; $fids[$this->fid]['thread'] += 1; $fids[$this->fid]['replies'] += $t['replies']; } if ($fids) { foreach ($fids as $fid => $value) { Wekit::load('forum.srv.PwForumService')->updateStatistics($fid, $value['thread'], $value['replies']); } } if (!$this->forum->isOpen()) { Wekit::load('attention.PwFresh')->batchDeleteByType(PwFresh::TYPE_THREAD_TOPIC, $this->tids); //回复与新鲜事的关联 if ($data = Wekit::load('attention.PwFreshIndex')->fetchByTid($this->tids)) { Wekit::load('attention.PwFresh')->batchDelete(array_keys($data)); } } //管理日志添加 Wekit::load('log.srv.PwLogService')->addThreadManageLog($this->srv->user, 'move', $this->srv->getData(), $this->_reason, $this->fid . '|' . $this->topictype); }
public function run() { $topicDm = new PwTopicDm(true); $topicDm->setTopictype($this->topictype); $this->_getThreadDs()->batchUpdateThread($this->tids, $topicDm, PwThread::FETCH_MAIN); //管理日志添加 Wekit::load('log.srv.PwLogService')->addThreadManageLog($this->srv->user, 'type', $this->threadsInfo, $this->_reason, $this->topictype); }