public function run() { Wind::import('SRV:forum.dm.PwReplyDm'); Wind::import('SRV:forum.dm.PwTopicDm'); $replyDm = new PwReplyDm($this->pid); $replyDm->setTopped($this->topped); $this->_getThreadDs()->updatePost($replyDm); $topicDm = new PwTopicDm($this->tid); if ($this->topped) { $toppedDm = new PwPostsToppedDm(); $toppedDm->setPid($this->pid)->setTid($this->tid)->setCreatedUserid($this->srv->user->uid)->setFloor($this->lou); $this->_getPostsToppedDs()->addTopped($toppedDm); $topicDm->addReplyTopped(1); } else { $topicDm->addReplyTopped(-1); $this->_getPostsToppedDs()->deleteTopped($this->pid); } $this->_getThreadDs()->updateThread($topicDm, PwThread::FETCH_MAIN); if ($this->topped == 1) { $type = 'threadtopped'; } else { $type = 'untopped'; } Wekit::load('log.srv.PwLogService')->addThreadManageLog($this->srv->user, $type, $this->srv->getData(), $this->_reason, '', true); return true; }
/** * 删除某个置顶楼层 * * @param int $pid * @return bool */ public function updateTopped($pid, PwPostsToppedDm $dm) { $pid = intval($pid); if ($pid < 1) { return false; } if (($result = $dm->beforeUpdate()) instanceof PwError) { return $result; } return $this->_getDao()->update($pid, $dm->getData()); }