用户下载记录中包括在线和离线信息

This commit is contained in:
wlx 2011-09-16 07:49:50 +00:00
parent a5bedc802a
commit 03eebeb206
1 changed files with 12 additions and 7 deletions

View File

@ -352,16 +352,19 @@ class Admin_DownController extends Zend_Controller_Action
if(empty($show)) if(empty($show))
{ {
$select=$this->db->select(); $select=$this->db->select();
$select->from('onlineapp as o','count(o.id) as num') $select->from('dataorder as o','count(o.id) as num')
->join('users as u', 'u.id = o.userid', array('realname','id as uid')) ->join('users as u', 'u.id = o.userid', array('realname','id as uid','unit'))
->where('o.userid = u.id'); ->where('o.userid = u.id')
->where('o.status=0 or o.status=5');
if(!empty($search) && !empty($keyword)) if(!empty($search) && !empty($keyword))
{ {
$select ->Where('u.realname like ? ','%'.$keyword.'%'); $select ->Where('u.realname like ? ','%'.$keyword.'%');
$select ->orWhere('u.unit like ? ','%'.$keyword.'%');
$this->view->title='“'.$keyword.'”的搜索结果 :'; $this->view->title='“'.$keyword.'”的搜索结果 :';
} }
$select ->group('uid') $select ->group('uid')
->group('realname') ->group('realname')
->group('unit')
->order('num desc'); ->order('num desc');
$paginator = Zend_Paginator::factory($select); $paginator = Zend_Paginator::factory($select);
$paginator->setCurrentPageNumber($this->_getParam('page')); $paginator->setCurrentPageNumber($this->_getParam('page'));
@ -377,9 +380,11 @@ class Admin_DownController extends Zend_Controller_Action
elseif($show) elseif($show)
{ {
$select=$this->db->select(); $select=$this->db->select();
$select->from('onlineapp as o',array('id','username','ts_created','userid')) $select->from('dataorder as o',array('id','ts_created','userid','offlineappid'))
->join('metadata as m', 'o.uuid = m.uuid', array('title','uuid')) ->joinLeft('metadata as m', 'o.uuid = m.uuid', array('title','uuid'))
->joinLeft('users as u','u.id=o.userid',array('realname as username'))
->where('o.userid = ?', $show) ->where('o.userid = ?', $show)
->where('o.status=0 or o.status=5')
->order('o.id desc'); ->order('o.id desc');
$paginator = Zend_Paginator::factory($select); $paginator = Zend_Paginator::factory($select);
$paginator->setCurrentPageNumber($this->_getParam('page')); $paginator->setCurrentPageNumber($this->_getParam('page'));
@ -413,7 +418,7 @@ class Admin_DownController extends Zend_Controller_Action
if(!empty($search) && !empty($keyword)) if(!empty($search) && !empty($keyword))
{ {
$select ->Where('m.title like ?','%'.$keyword.'%'); $select ->Where('m.title like ?','%'.$keyword.'%');
$select->orWhere('m.uuid=?',$keyword); $select ->Where('m.title_en like ?','%'.$keyword.'%');
$this->view->title='“'.$keyword.'”的搜索结果 :'; $this->view->title='“'.$keyword.'”的搜索结果 :';
} }
$select ->group('m.title') $select ->group('m.title')