add hot and latest action in search

This commit is contained in:
wlx 2016-03-21 20:58:29 +08:00
parent 42db7897d2
commit a7b2365317
1 changed files with 27 additions and 0 deletions

View File

@ -40,6 +40,33 @@ class SearchController extends Zend_Controller_Action
header("Content-Type: application/json; charset=utf-8"); header("Content-Type: application/json; charset=utf-8");
echo $search->suggest($q); echo $search->suggest($q);
} }
function hotAction()
{
$sql="select m.uuid,title from normalmetadata m left join mdstat s on m.uuid=s.uuid order by s.viewed desc limit 10";
$sth = $this->db->prepare($sql);
$sth ->execute();
$rows = $sth->fetchAll();
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
header("Content-Type: application/json; charset=utf-8");
echo json_encode($rows);;
}
function latestAction()
{
$sql="select uuid,title from normalmetadata order by ts_created desc limit 10";
$sth = $this->db->prepare($sql);
$sth ->execute();
$rows = $sth->fetchAll();
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
header("Content-Type: application/json; charset=utf-8");
echo json_encode($rows);;
}
function advanceAction() function advanceAction()
{ {
$this->view->east=$this->getParam('east'); $this->view->east=$this->getParam('east');