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'); }
public function replyAction() { $id = $this->getInput('id'); Wind::import('SRV:attention.srv.PwFreshReplyList'); $reply = new PwFreshReplyList($id); $fresh = $reply->getData(); $replies = $reply->getReplies(7); $replies = Wekit::load('forum.srv.PwThreadService')->displayReplylist($replies); $count = count($replies); if ($count > 6) { $replies = array_slice($replies, 0, 6, true); } $this->setOutput($count, 'count'); $this->setOutPut($replies, 'replies'); $this->setOutPut($fresh, 'fresh'); }