public function run($ids) { Wind::import('SRV:forum.dm.PwTopicDm'); Wind::import('SRV:forum.dm.PwReplyDm'); $threadDs = Wekit::load('forum.PwThread'); $forumSrv = Wekit::load('forum.srv.PwForumService'); foreach ($this->tids as $tid => $value) { $dm1 = new PwReplyDm(true); $dm1->setTid($tid); $value['disabled'] != 2 && $dm1->setDisabled(0); $threadDs->batchUpdatePost($value['ids'], $dm1); $post = current(Wekit::load('forum.PwThread')->getPostByTid($tid, 1, 0, false)); $dm = new PwTopicDm($tid); $dm->addReplies($value['replies']); $post && $dm->setLastpost($post['created_userid'], $post['created_username'], $post['created_time']); $threadDs->updateThread($dm, PwThread::FETCH_MAIN); } foreach ($this->fids as $fid => $value) { $forumSrv->updateStatistics($fid, 0, $value); } foreach ($this->rpids as $rpid => $value) { $dm = new PwReplyDm($rpid); $dm->addReplies($value); $threadDs->updatePost($dm); } Wekit::load('recycle.PwReplyRecycle')->batchDelete($ids); }
public function run($ids) { $service = Wekit::load('forum.PwThread'); $service->batchDeletePost($ids); foreach ($this->tids as $tid => $value) { $post = current($service->getPostByTid($tid, 1, 0, false)); $dm = new PwTopicDm($tid); $dm->addReplies(-$value); $dm->setLastpost($post['created_userid'], $post['created_username'], $post['created_time']); Wekit::load('forum.PwThread')->updateThread($dm, PwThread::FETCH_MAIN); } if ($this->recode) { Wekit::load('recycle.PwReplyRecycle')->batchDelete($this->recode); } }
public function run($ids) { Wind::import('SRV:forum.dm.PwReplyDm'); Wind::import('SRV:forum.dm.PwTopicDm'); $service = Wekit::load('forum.PwThread'); $dm = new PwReplyDm(); $dm->setDisabled(2)->setTid(0); $service->batchUpdatePost($ids, $dm); foreach ($this->tids as $tid => $value) { $post = current($service->getPostByTid($tid, 1, 0, false)); $dm = new PwTopicDm($tid); $dm->addReplies(-$value); $dm->setLastpost($post['created_userid'], $post['created_username'], $post['created_time']); Wekit::load('forum.PwThread')->updateThread($dm, PwThread::FETCH_MAIN); } Wekit::load('recycle.PwReplyRecycle')->batchAdd($this->record); }
protected function run() { Wind::import('SRV:forum.dm.PwReplyDm'); Wind::import('SRV:forum.dm.PwTopicDm'); $dm = new PwReplyDm(true); $dm->setDisabled(0); Wekit::load('forum.PwThread')->batchUpdatePost($this->pids, $dm); foreach ($this->tids as $tid => $value) { $post = current(Wekit::load('forum.PwThread')->getPostByTid($tid, 1, 0, false)); $dm = new PwTopicDm($tid); $dm->addReplies($value); $dm->setLastpost($post['created_userid'], $post['created_username'], $post['created_time']); Wekit::load('forum.PwThread')->updateThread($dm, PwThread::FETCH_MAIN); } foreach ($this->fids as $fid => $value) { Wekit::load('forum.srv.PwForumService')->updateStatistics($fid, 0, $value, $value); } foreach ($this->rpids as $rpid => $value) { $dm = new PwReplyDm($rpid); $dm->addReplies($value); Wekit::load('forum.PwThread')->updatePost($dm); } return true; }
/** * 编辑回复后续操作<更新版块、缓存等信息> */ public function afterPost() { if ($this->postDm->getIscheck() != $this->info['ischeck']) { $reply = $this->info['ischeck'] ? -1 : 1; Wekit::load('forum.srv.PwForumService')->updateStatistics($this->forum, 0, $reply, $reply); Wind::import('SRV:forum.dm.PwTopicDm'); $dm = new PwTopicDm($this->tid); $dm->addReplies($reply); $this->_getThreadService()->updateThread($dm, PwThread::FETCH_MAIN); if ($this->info['rpid']) { $dm = new PwReplyDm($this->info['rpid']); $dm->addReplies($reply); $this->_getThreadService()->updatePost($dm); } } //编辑非自己的帖子回复添加管理日志 if ($this->info['created_userid'] != $this->user->uid) { $thread = $this->info; $thread['subject'] = $this->postDm->getField('subject') ? $this->postDm->getField('subject') : $this->info['subject']; Wekit::load('log.srv.PwLogService')->addEditThreadLog($this->user, $thread, true); } }
public function doPassPostAction() { $pid = $this->getInput('pid'); if (empty($pid)) { $this->showError('operate.select'); } !is_array($pid) && ($pid = array($pid)); $fids = $tids = array(); $postdb = Wekit::load('forum.PwThread')->fetchPost($pid); foreach ($postdb as $key => $value) { $fids[$value['fid']]++; $tids[$value['tid']]++; } Wind::import('SRV:forum.dm.PwReplyDm'); Wind::import('SRV:forum.dm.PwTopicDm'); $dm = new PwReplyDm(true); $dm->setDisabled(0); Wekit::load('forum.PwThread')->batchUpdatePost($pid, $dm); foreach ($tids as $key => $value) { $post = current(Wekit::load('forum.PwThread')->getPostByTid($key, 1, 0, false)); $dm = new PwTopicDm($key); $dm->addReplies($value); $dm->setLastpost($post['created_userid'], $post['created_username'], $post['created_time']); Wekit::load('forum.PwThread')->updateThread($dm, PwThread::FETCH_MAIN); } foreach ($fids as $fid => $value) { Wekit::load('forum.srv.PwForumService')->updateStatistics($fid, 0, $value, $value); } $this->showMessage('success'); }
/** * 回帖后续操作<更新版块、缓存等信息> */ public function afterPost() { if ($rpid = $this->postDm->getField('rpid')) { Wekit::load('forum.PwPostsReply')->add($this->pid, $rpid); } if ($this->postDm->getIscheck()) { $title = $this->postDm->getTitle() ? $this->postDm->getTitle() : 'Re:' . $this->info['subject']; $this->forum->addPost($this->tid, $this->user->username, $title); Wind::import('SRV:forum.dm.PwTopicDm'); $dm = new PwTopicDm($this->tid); $timestamp = Pw::getTime(); if ($this->info['lastpost_time'] > $timestamp || Pw::getstatus($this->info['tpcstatus'], PwThread::STATUS_DOWNED)) { $timestamp = null; } $dm->addReplies(1)->addHits(1)->setLastpost($this->user->uid, $this->user->username, $timestamp); $this->_getThreadsService()->updateThread($dm, PwThread::FETCH_MAIN); if ($rpid) { Wind::import('SRV:forum.dm.PwReplyDm'); $dm = new PwReplyDm($rpid); $dm->addReplies(1); $this->_getThreadsService()->updatePost($dm); } } }