コード例 #1
0
 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);
 }
コード例 #2
0
 public function run()
 {
     if (1 == $this->ifShield) {
         $type = 'shield';
     } else {
         $type = 'unshield';
     }
     if ($this->pids) {
         Wind::import('SRV:forum.dm.PwReplyDm');
         $topicDm = new PwReplyDm(true);
         $topicDm->setIfshield($this->ifShield);
         $this->_getThreadDs()->batchUpdatePost($this->pids, $topicDm);
         //回复的屏蔽处理:被站内置顶的回复也会在屏蔽范围内,排除
         if (!$this->tids) {
             Wekit::load('log.srv.PwLogService')->addThreadManageLog($this->srv->user, $type, $this->threads['p'], $this->_reason, '', true);
         }
     }
     if ($this->tids) {
         Wind::import('SRV:forum.dm.PwTopicDm');
         $topicDm = new PwTopicDm(true);
         $topicDm->setIfshield($this->ifShield);
         $this->_getThreadDs()->batchUpdateThread($this->tids, $topicDm, PwThread::FETCH_MAIN);
         //帖子的屏蔽处理
         Wekit::load('log.srv.PwLogService')->addThreadManageLog($this->srv->user, $type, $this->threads['t'], $this->_reason);
     }
 }
コード例 #3
0
 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;
 }
コード例 #4
0
 public function run($ids)
 {
     Wind::import('SRV:forum.dm.PwReplyDm');
     $srv = Wekit::load('forum.PwThread');
     foreach ($this->record as $rpid => $value) {
         $dm = new PwReplyDm($rpid);
         $dm->addReplies(-$value);
         $srv->updatePost($dm);
     }
 }
コード例 #5
0
 /**
  * 
  * 忽略一个回复通知
  * @param array $notice
  */
 public function ignoreNotice($notice, $ignore = 1)
 {
     if (!$notice) {
         return false;
     }
     Wind::import('SRV:forum.dm.PwReplyDm');
     $dm = new PwReplyDm($notice['param']);
     $dm->setReplyNotice($ignore ? 0 : 1);
     $this->_getThreadDs()->updatePost($dm);
 }
コード例 #6
0
 public function run($ids)
 {
     Wind::import('SRV:forum.dm.PwTopicDm');
     $dm = new PwTopicDm();
     $dm->setDisabled(2)->setTopped(0)->setDigest(0);
     Wekit::load('forum.PwThread')->batchUpdateThread($ids, $dm);
     Wind::import('SRV:forum.dm.PwReplyDm');
     $dm = new PwReplyDm();
     $dm->setDisabled(2);
     Wekit::load('forum.PwThread')->batchUpdatePostByTid($ids, $dm);
     Wekit::load('recycle.PwTopicRecycle')->batchAdd($this->record);
 }
コード例 #7
0
 public function run($ids)
 {
     $so = new PwThreadSo();
     $so->setFid($this->srv->fid);
     $data = Wekit::load('forum.PwThread')->searchThread($so, 0);
     $tids = array_keys($data);
     $dm = new PwTopicDm();
     $dm->setFid($this->srv->tofid);
     Wekit::load('forum.PwThread')->batchUpdateThread($tids, $dm, PwThread::FETCH_MAIN);
     $dm = new PwReplyDm();
     $dm->setFid($this->srv->tofid);
     Wekit::load('forum.PwThread')->batchUpdatePostByTid($tids, $dm);
 }
コード例 #8
0
 public function run()
 {
     $remind = $this->ifRemind ? $this->_buildRemind() : '';
     if ($this->pids) {
         Wind::import('SRV:forum.dm.PwReplyDm');
         $topicDm = new PwReplyDm(true);
         $topicDm->setManageRemind($remind);
         $this->_getThreadDs()->batchUpdatePost($this->pids, $topicDm);
     }
     if ($this->tids) {
         Wind::import('SRV:forum.dm.PwTopicDm');
         $topicDm = new PwTopicDm(true);
         $topicDm->setManageRemind($remind);
         $this->_getThreadDs()->batchUpdateThread($this->tids, $topicDm, PwThread::FETCH_CONTENT);
     }
 }
コード例 #9
0
 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);
 }
コード例 #10
0
ファイル: PwPassReply.php プロジェクト: fanqimeng/4tweb
 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;
 }
コード例 #11
0
ファイル: PwThread.php プロジェクト: YoursBoss/nextwind
 /**
  * 批量更新帖子
  *
  * @param array $tids 帖子id
  * @param object $replyDm 帖子数据模型
  * @return mixed
  */
 public function batchUpdatePostByTid($tids, PwReplyDm $replyDm)
 {
     if (empty($tids)) {
         return false;
     }
     if (($result = $replyDm->beforeUpdate()) !== true) {
         return $result;
     }
     return $this->_getPostDao()->batchUpdatePostByTid($tids, $replyDm->getData(), $replyDm->getIncreaseData());
 }
コード例 #12
0
 public function __construct($pid = 0)
 {
     parent::__construct($pid);
 }
コード例 #13
0
 public function buyAction()
 {
     list($tid, $pid) = $this->getInput(array('tid', 'pid'));
     $submit = (int) $this->getInput('submit', 'get');
     if (!$this->loginUser->isExists()) {
         $this->showError('login.not');
     }
     if (!$tid) {
         $this->showError('data.error');
     }
     if ($pid) {
         $result = Wekit::load('forum.PwThread')->getPost($pid);
     } else {
         $pid = 0;
         $result = Wekit::load('forum.PwThread')->getThread($tid, PwThread::FETCH_ALL);
     }
     if (empty($result) || $result['tid'] != $tid) {
         $this->showError('data.error');
     }
     $start = strpos($result['content'], '[sell=');
     if ($start === false) {
         $this->showError('BBS:thread.buy.error.sell.not');
     }
     $start += 6;
     $end = strpos($result['content'], ']', $start);
     $cost = substr($result['content'], $start, $end - $start);
     list($creditvalue, $credittype) = explode(',', $cost);
     Wind::import('SRV:credit.bo.PwCreditBo');
     $creditBo = PwCreditBo::getInstance();
     isset($creditBo->cType[$credittype]) || ($credittype = key($creditBo->cType));
     $creditType = $creditBo->cType[$credittype];
     if ($result['created_userid'] == $this->loginUser->uid) {
         $this->showError('BBS:thread.buy.error.self');
     }
     if (Wekit::load('forum.PwThreadBuy')->get($tid, $pid, $this->loginUser->uid)) {
         $this->showError('BBS:thread.buy.error.already');
     }
     if (($myCredit = $this->loginUser->getCredit($credittype)) < $creditvalue) {
         $this->showError(array('BBS:thread.buy.error.credit.notenough', array('{myCredit}' => $myCredit . $creditType, '{count}' => $creditvalue . $creditType)));
     }
     !$submit && $this->showMessage(array('BBS:thread.buy.message.buy', array('{count}' => $myCredit . $creditType, '{buyCount}' => -$creditvalue . $creditType)));
     Wind::import('SRV:forum.dm.PwThreadBuyDm');
     $dm = new PwThreadBuyDm();
     $dm->setTid($tid)->setPid($pid)->setCreatedUserid($this->loginUser->uid)->setCreatedTime(Pw::getTime())->setCtype($credittype)->setCost($creditvalue);
     Wekit::load('forum.PwThreadBuy')->add($dm);
     $creditBo->addLog('buythread', array($credittype => -$creditvalue), $this->loginUser, array('title' => $result['subject'] ? $result['subject'] : Pw::substrs($result['content'], 20)));
     $creditBo->set($this->loginUser->uid, $credittype, -$creditvalue, true);
     $user = new PwUserBo($result['created_userid']);
     if (($max = $user->getPermission('sell_credit_range.maxincome')) && Wekit::load('forum.PwThreadBuy')->sumCost($tid, $pid) > $max) {
     } else {
         $creditBo->addLog('sellthread', array($credittype => $creditvalue), $user, array('title' => $result['subject'] ? $result['subject'] : Pw::substrs($result['content'], 20)));
         $creditBo->set($user->uid, $credittype, $creditvalue, true);
     }
     $creditBo->execute();
     if ($pid) {
         Wind::import('SRV:forum.dm.PwReplyDm');
         $dm = new PwReplyDm($pid);
         $dm->addSellCount(1);
         Wekit::load('forum.PwThread')->updatePost($dm);
     } else {
         Wind::import('SRV:forum.dm.PwTopicDm');
         $dm = new PwTopicDm($tid);
         $dm->addSellCount(1);
         Wekit::load('forum.PwThread')->updateThread($dm, PwThread::FETCH_CONTENT);
     }
     $this->showMessage('success', 'bbs/read/run/?tid=' . $tid . '&fid=' . $result['fid'], true);
 }
コード例 #14
0
 public function deleteAction()
 {
     $aid = $this->getInput('aid', 'post');
     if (!$aid) {
         $this->showError('operate.fail');
     }
     if (!($attach = Wekit::load('attach.PwThreadAttach')->getAttach($aid))) {
         $this->showError('data.error');
     }
     Wind::import('SRV:forum.bo.PwForumBo');
     $forum = new PwForumBo($attach['fid']);
     if (!$forum->isForum()) {
         $this->showError('data.error');
     }
     if ($this->loginUser->uid != $attach['created_userid']) {
         if (!$this->loginUser->getPermission('operate_thread.deleteatt', $forum->isBM($this->loginUser->username))) {
             $this->showError('permission.attach.delete.deny');
         }
         if (!$this->loginUser->comparePermission($attach['created_userid'])) {
             $this->showError(array('permission.level.deleteatt', array('{grouptitle}' => $this->loginUser->getGroupInfo('name'))));
         }
     }
     Wekit::load('attach.PwThreadAttach')->deleteAttach($aid);
     Pw::deleteAttach($attach['path'], $attach['ifthumb']);
     if ($this->loginUser->uid != $attach['created_userid']) {
         Wekit::load('log.srv.PwLogService')->addDeleteAtachLog($this->loginUser, $attach);
     }
     if ($attach['tid']) {
         if (!$attach['pid']) {
             $thread = Wekit::load('forum.PwThread')->getThread($attach['tid'], PwThread::FETCH_ALL);
             Wind::import('SRV:forum.dm.PwTopicDm');
             $dm = new PwTopicDm($attach['tid']);
             if (!Wekit::load('attach.PwThreadAttach')->countType($attach['tid'], 0, $attach['type'])) {
                 $dm->setHasAttach($attach['type'], false);
             }
             if (!Pw::getstatus($thread['tpcstatus'], PwThread::STATUS_OPERATORLOG) && $this->loginUser->uid != $attach['created_userid']) {
                 $dm->setOperatorLog(true);
             }
         } else {
             $thread = Wekit::load('forum.PwThread')->getPost($attach['pid']);
             Wind::import('SRV:forum.dm.PwReplyDm');
             $dm = new PwReplyDm($attach['pid']);
         }
         if ($thread['aids'] > 0) {
             $thread['aids']--;
         }
         $dm->setAids($thread['aids']);
         if (($content = str_replace('[attachment=' . $aid . ']', '', $thread['content'])) != $thread['content']) {
             $dm->setContent($content);
         }
         if (!$attach['pid']) {
             Wekit::load('forum.PwThread')->updateThread($dm);
         } else {
             Wekit::load('forum.PwThread')->updatePost($dm);
         }
     }
     $this->showMessage('success');
 }
コード例 #15
0
ファイル: PwReplyPost.php プロジェクト: fanqimeng/4tweb
 /**
  * 回帖后续操作<更新版块、缓存等信息>
  */
 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);
         }
     }
 }
コード例 #16
0
ファイル: ContentController.php プロジェクト: fanqimeng/4tweb
 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');
 }
コード例 #17
0
ファイル: PwReplyModify.php プロジェクト: YoursBoss/nextwind
 /**
  * 编辑回复后续操作<更新版块、缓存等信息>
  */
 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);
     }
 }
コード例 #18
0
 private function _updateLikeCount($typeid, $fromid, $count)
 {
     switch ($typeid) {
         case PwLikeContent::THREAD:
             Wind::import('SRV:forum.dm.PwTopicDm');
             $dm = new PwTopicDm($fromid);
             $dm->setLikeCount($count);
             return Wekit::load('forum.PwThread')->updateThread($dm, PwThread::FETCH_MAIN);
         case PwLikeContent::POST:
             Wind::import('SRV:forum.dm.PwReplyDm');
             $dm = new PwReplyDm($fromid);
             $dm->setLikeCount($count);
             return Wekit::load('forum.PwThread')->updatePost($dm);
         case PwLikeContent::WEIBO:
             Wind::import('SRV:weibo.dm.PwWeiboDm');
             $dm = new PwWeiboDm($fromid);
             $dm->setLikeCount($count);
             return Wekit::load('weibo.PwWeibo')->updateWeibo($dm);
         case PwLikeContent::APP:
             Wind::import('SRV:like.dm.PwLikeSourceDm');
             $dm = new PwLikeSourceDm($fromid);
             $dm->setLikeCount($count);
             return Wekit::load('like.PwLikeSource')->updateSource($dm);
     }
 }