Пример #1
0
 public function freshAction()
 {
     list($id, $weiboid) = $this->getInput(array('id', 'weiboid'));
     $page = intval($this->getInput('page'));
     if ($weiboid) {
         Wind::import('SRV:attention.srv.dataSource.PwFetchFreshByTypeAndSrcId');
         $dataSource = new PwFetchFreshByTypeAndSrcId(3, array($weiboid));
     } else {
         Wind::import('SRV:attention.srv.dataSource.PwGetFreshById');
         $dataSource = new PwGetFreshById($id);
     }
     Wind::import('SRV:attention.srv.PwFreshDisplay');
     $freshDisplay = new PwFreshDisplay($dataSource);
     if (!($fresh = $freshDisplay->gather())) {
         $this->showError('fresh.exists.not');
     }
     Wind::import('LIB:ubb.PwSimpleUbbCode');
     Wind::import('LIB:ubb.config.PwUbbCodeConvertThread');
     Wind::import('SRV:attention.srv.PwFreshReplyList');
     $fresh = current($fresh);
     $id = $fresh['id'];
     $page < 1 && ($page = 1);
     $perpage = 10;
     list($offset, $limit) = Pw::page2limit($page, $perpage);
     $reply = new PwFreshReplyList($id);
     $replies = $reply->getReplies($limit, $offset);
     $replies = Wekit::load('forum.srv.PwThreadService')->displayReplylist($replies);
     $this->setOutput($fresh, 'fresh');
     $this->setOutput($replies, 'replies');
     $this->setOutput($id, 'id');
     $this->setOutput($fresh['created_userid'], 'uid');
     $this->setOutput($page, 'page');
     $this->setOutput($perpage, 'perpage');
     $this->setOutput($fresh['replies'], 'count');
 }
Пример #2
0
 protected function modelFreshList($limit, $page)
 {
     Wind::import('SRV:attention.srv.PwFreshDisplay');
     Wind::import('SRV:attention.srv.dataSource.PwFetchMyFresh');
     $count = Wekit::load('attention.PwFresh')->countFreshByUid($this->spaceUid);
     $totalpage = ceil($count / $limit);
     $page > $totalpage && ($page = $totalpage);
     list($offset, $limit) = Pw::page2limit($page, $limit);
     $freshDisplay = new PwFreshDisplay(new PwFetchMyFresh($this->spaceUid, $limit, $offset));
     return array($count, $freshDisplay->gather());
 }
Пример #3
0
 public function postAction()
 {
     $fid = $this->getInput('fid');
     $_getHtml = $this->getInput('_getHtml', 'get');
     list($content, $topictype, $subtopictype) = $this->getInput(array('content', 'topictype', 'sub_topictype'), 'post');
     Wind::import('SRV:forum.srv.post.PwTopicPost');
     Wind::import('SRV:forum.srv.PwPost');
     $postAction = new PwTopicPost($fid);
     $pwpost = new PwPost($postAction);
     $this->runHook('c_fresh_post', $pwpost);
     if (($result = $pwpost->check()) !== true) {
         $this->showError($result->getError());
     }
     $postDm = $pwpost->getDm();
     $postDm->setTitle(Pw::substrs(Pw::stripWindCode($content), 30))->setContent($content);
     $topictype_id = $subtopictype ? $subtopictype : $topictype;
     $topictype_id && $postDm->setTopictype($topictype_id);
     if (($result = $pwpost->execute($postDm)) !== true) {
         $data = $result->getData();
         $data && $this->addMessage($data, 'data');
         $this->showError($result->getError());
     }
     if (!$postDm->getField('ischeck')) {
         $this->showMessage('BBS:post.topic.ischeck');
     } elseif ($_getHtml == 1) {
         Wind::import('SRV:attention.srv.dataSource.PwFetchFreshByTypeAndSrcId');
         $freshDisplay = new PwFreshDisplay(new PwFetchFreshByTypeAndSrcId(1, array($pwpost->getNewId())));
         $fresh = $freshDisplay->gather();
         $fresh = current($fresh);
         $this->setOutput($fresh, 'fresh');
     } else {
         $this->showMessage('success');
     }
 }