Esempio n. 1
0
 protected function run()
 {
     $forum = new PwForumBo($this->fid, true);
     if (!$forum->isForum(true)) {
         return new PwError('BBS:forum.unite.error.fid.exists.not');
     }
     if ($forum->foruminfo['type'] == 'category') {
         return new PwError('BBS:forum.unite.error.fid.category');
     }
     if ($forum->getSubForums()) {
         return new PwError('BBS:forum.unite.error.hassub');
     }
     $toforum = new PwForumBo($this->tofid);
     if (!$toforum->isForum(true)) {
         return new PwError('BBS:forum.unite.error.tofid.exists.not');
     }
     if ($toforum->foruminfo['type'] == 'category') {
         return new PwError('BBS:forum.unite.error.tofid.category');
     }
     if ($this->fid == $this->tofid) {
         return new PwError('BBS:forum.unite.error.same');
     }
     Wekit::load('forum.PwForum')->deleteForum($this->fid);
     Wind::import('SRV:forum.dm.PwForumDm');
     $dm = new PwForumDm($this->tofid);
     $dm->addThreads($forum->foruminfo['threads'])->addPosts($forum->foruminfo['posts']);
     Wekit::load('forum.PwForum')->updateForum($dm, PwForum::FETCH_STATISTICS);
     Wekit::load('forum.srv.PwForumService')->updateForumStatistics($forum->foruminfo['parentid']);
     Wekit::load('forum.srv.PwForumService')->updateForumStatistics($this->tofid);
     return true;
 }
Esempio n. 2
0
 /**
  * 复制帖子 | 复制特殊帖、附件等待做。。。
  *
  * @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);
 }
Esempio n. 3
0
 /**
  * 更新版块帖子统计数
  *
  * @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;
 }