public function run() { list($name, $ifhot, $min_count, $max_count, $page) = $this->getInput(array('name', 'ifhot', 'min_count', 'max_count', 'page')); $perpage = 10; $page = intval($page); $page < 1 && ($page = 1); $tagSo = new PwUserTagSo(); $tagSo->setName($name)->setIfhot($ifhot)->setMaxCount($max_count)->setMinCount($min_count); $total = $this->_getDs()->countSearchTag($tagSo); $totalPage = 0; $list = array(); if ($total > 0) { $totalPage = ceil($total / $perpage); $page > $totalPage && ($page = $totalPage); list($start, $limit) = Pw::page2limit($page, $perpage); $list = $this->_getDs()->searchTag($tagSo, $limit, $start); } $this->setOutput($list, 'list'); $this->setOutput($perpage, 'perpage'); $this->setOutput($tagSo->getData(), 'args'); $this->setOutput($page, 'page'); $this->setOutput($total, 'count'); }
/** * 统计搜索的个人标签 * * @param PwUserTagSo $tagSo * @return int */ public function countSearchTag(PwUserTagSo $tagSo) { return $this->_getDao()->countSearchTag($tagSo->getData()); }