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

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