/** * * 获取帖子详细页只看楼主的回复 * * @param int $tid * @param int $uid */ public function getByTidAndUid($tid, $uid, $page, $offset = 0, $limit = 10) { list($tid, $uid, $page, $offset, $limit) = array(intval($tid), intval($uid), intval($page), intval($offset), intval($limit)); if ($tid < 1 || $uid < 1) { return $this->buildResponse(THREAD_INVALID_PARAMS, "参数错误"); } $user = PwUserBo::getInstance($uid); if (!$user->isExists()) { return $this->buildResponse(USER_NOT_EXISTS, "用户不存在"); } list($start, $limit) = Pw::page2limit($page, $limit); $postResult = $this->_getThread()->getPostByTidAndUid($tid, $uid, $limit, $start); if (!$postResult) { return $this->buildResponse(-1, $postResult->getError()); } Wind::import('SRV:forum.vo.PwPostSo'); $so = new PwPostSo(); $so->setTid($tid)->setAuthorId($uid); $count = $this->_getThread()->countSearchPost($so); return $this->buildResponse(0, array('posts' => $postResult, 'count' => $count)); }
public function replyAction() { $page = intval($this->getInput('page')); list($author, $fid, $createdTimeStart, $createdTimeEnd) = $this->getInput(array('author', 'fid', 'created_time_start', 'created_time_end')); $page < 1 && ($page = 1); $perpage = 20; list($start, $limit) = Pw::page2limit($page, $perpage); Wind::import('SRV:forum.vo.PwPostSo'); $so = new PwPostSo(); $so->setDisabled(1)->orderbyCreatedTime(0); $url = array(); if ($author) { $so->setAuthor($author); $url['author'] = $author; } if ($fid) { $so->setFid($fid); $url['fid'] = $fid; } if ($createdTimeStart) { $so->setCreateTimeStart(Pw::str2time($createdTimeStart)); $url['created_time_start'] = $createdTimeStart; } if ($createdTimeEnd) { $so->setCreateTimeEnd(Pw::str2time($createdTimeEnd)); $url['created_time_end'] = $createdTimeEnd; } $count = Wekit::load('forum.PwThread')->countSearchPost($so); $postdb = Wekit::load('forum.PwThread')->searchPost($so, $limit, $start); $this->setOutput($postdb, 'postdb'); $this->setOutput(Wekit::load('forum.srv.PwForumService')->getForumOption($fid), 'option_html'); $this->setOutput($page, 'page'); $this->setOutput($perpage, 'perpage'); $this->setOutput($count, 'count'); $this->setOutput($url, 'url'); // seo设置 Wind::import('SRV:seo.bo.PwSeoBo'); $lang = Wind::getComponent('i18n'); PwSeoBo::setCustomSeo($lang->getMessage('SEO:manage.content.reply.title'), '', ''); }
public function replyAction() { $page = intval($this->getInput('page')); list($author, $fid, $createdTimeStart, $createdTimeEnd) = $this->getInput(array('author', 'fid', 'created_time_start', 'created_time_end')); $page < 1 && ($page = 1); $perpage = 20; list($start, $limit) = Pw::page2limit($page, $perpage); Wind::import('SRV:forum.vo.PwPostSo'); $so = new PwPostSo(); $so->setDisabled(1)->orderbyCreatedTime(0); $args = array(); if ($author) { $so->setAuthor($author); $args['author'] = $author; } if ($fid) { $forum = Wekit::load('forum.PwForum')->getForum($fid); if ($forum['type'] != 'category') { $so->setFid($fid); } else { $srv = Wekit::load('forum.srv.PwForumService'); $fids = array(0); $forums = $srv->getForumsByLevel($fid, $srv->getForumMap()); foreach ($forums as $value) { $fids[] = $value['fid']; } $so->setFid($fids); } } if ($createdTimeStart) { $so->setCreateTimeStart(Pw::str2time($createdTimeStart)); $args['created_time_start'] = $createdTimeStart; } if ($createdTimeEnd) { $so->setCreateTimeEnd(Pw::str2time($createdTimeEnd)); $args['created_time_end'] = $createdTimeEnd; } $count = Wekit::load('forum.PwThread')->countSearchPost($so); $postdb = Wekit::load('forum.PwThread')->searchPost($so, $limit, $start); $this->setOutput($postdb, 'postdb'); $this->setOutput(Wekit::load('forum.srv.PwForumService')->getForumList($fid), 'forumlist'); $this->setOutput(Wekit::load('forum.srv.PwForumService')->getForumOption($fid), 'option_html'); $this->setOutput($page, 'page'); $this->setOutput($perpage, 'perpage'); $this->setOutput($count, 'count'); $this->setOutput($args, 'args'); }
/** * 搜索回复 * * @param object $so * @return array */ public function searchPost(PwPostSo $so, $limit = 20, $offset = 0) { return $this->_getPostDao()->searchPost($so->getData(), $so->getOrderby(), $limit, $offset); }
public function searchreplyAction() { list($page, $perpage, $keyword, $fid, $created_username, $created_time_start, $created_time_end, $created_userid, $created_ip, $tid) = $this->getInput(array('page', 'perpage', 'keyword', 'fid', 'created_username', 'created_time_start', 'created_time_end', 'created_userid', 'created_ip', 'tid')); if ($created_username) { $user = $this->_getUserDs()->getUserByName($created_username); if (!$user) { $this->showError('USER:username.empty'); } if ($created_userid) { $created_userid != $user['uid'] && $this->showError('USER:username.notequal.uid'); } $created_userid = $user['uid']; } // dm条件 Wind::import('SRV:forum.vo.PwPostSo'); $dm = new PwPostSo(); $dm->setDisabled(0)->orderbyCreatedTime(false); $keyword && $dm->setKeywordOfTitleOrContent($keyword); if ($fid) { $forum = Wekit::load('forum.PwForum')->getForum($fid); if ($forum['type'] != 'category') { $dm->setFid($fid); } else { $srv = Wekit::load('forum.srv.PwForumService'); $fids = array(0); $forums = $srv->getForumsByLevel($fid, $srv->getForumMap()); foreach ($forums as $value) { $fids[] = $value['fid']; } $dm->setFid($fids); } } $created_userid && $dm->setAuthorId($created_userid); $created_time_start && $dm->setCreateTimeStart(Pw::str2time($created_time_start)); $created_time_end && $dm->setCreateTimeEnd(Pw::str2time($created_time_end)); $tid && $dm->setTid($tid); $created_ip && $dm->setCreatedIp($created_ip); $count = $this->_getThreadDs()->countSearchPost($dm); if ($count) { $page = $page ? $page : 1; $perpage = $perpage ? $perpage : $this->perpage; list($start, $limit) = Pw::page2limit($page, $perpage); $posts = $this->_getThreadDs()->searchPost($dm, $limit, $start); } $this->setOutput($count, 'count'); $this->setOutput($page, 'page'); $this->setOutput($perpage, 'perpage'); $this->setOutput(array('keyword' => $keyword, 'created_username' => $created_username, 'created_time_start' => $created_time_start, 'created_time_end' => $created_time_end, 'fid' => $fid, 'created_userid' => $created_userid, 'created_ip' => $created_ip, 'tid' => $tid), 'args'); $this->setOutput($this->_getFroumService()->getForumList($fid), 'forumList'); $this->setOutput($this->_getFroumService()->getForumOption($fid), 'option_html'); $this->setOutput($posts, 'posts'); }