diff --git a/application/admin/controllers/DownController.php b/application/admin/controllers/DownController.php index ab7c3153..03315cae 100644 --- a/application/admin/controllers/DownController.php +++ b/application/admin/controllers/DownController.php @@ -185,6 +185,7 @@ class Admin_DownController extends Zend_Controller_Action $down=(int)$this->_getParam('down'); $update=$this->_getParam('update'); $show=$this->_getParam('show'); + $undelete=$this->_getParam('undelete'); if ($add) { $form=new OfflinelogForm(); @@ -244,7 +245,29 @@ class Admin_DownController extends Zend_Controller_Action $this->messenger->addMessage($e->getMessage()); } $this->_redirect("/admin/down/offline"); - } elseif ($down) { + }else if($undelete){ + $sql="delete from offlineapp where id='$undelete'"; + $sql2="delete from dataorder where offlineappid='$undelete'"; + + if($this->db->exec($sql)>0) + { + if($this->db->exec($sql2)>0) + { + $this->messenger->addMessage('成功删除了数据服务记录,并且删除了关联的申请记录'); + $this->_redirect("/admin/down/offline"); + } + else + { + $this->messenger->addMessage('成功删除了数据服务记录,但并未找到关联的申请记录'); + $this->_redirect("/admin/down/offline"); + } + } + else { + $this->messenger->addMessage('删除失败'); + $this->_redirect("/admin/down/offline"); + } + } + elseif ($down) { $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(); $sql="select * from offlineapp where ts_approved is not null and pdflink is not null order by ts_created desc"; @@ -366,19 +389,16 @@ class Admin_DownController extends Zend_Controller_Action if(empty($show)) { $select=$this->db->select(); - $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'); + $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'); if(!empty($search) && !empty($keyword)) { $select ->Where('u.realname like ? or u.unit like ? ','%'.$keyword.'%'); - $select ->orWhere('u.unit like ? ','%'.$keyword.'%'); $this->view->title='“'.$keyword.'”的搜索结果 :'; } $select ->group('uid') - ->group('realname') - ->group('unit') + ->group('realname') ->order('num desc'); $paginator = Zend_Paginator::factory($select); $paginator->setCurrentPageNumber($this->_getParam('page')); @@ -394,11 +414,9 @@ class Admin_DownController extends Zend_Controller_Action elseif($show) { $select=$this->db->select(); - $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')) + $select->from('onlineapp as o',array('id','username','ts_created','userid')) + ->join('metadata as m', 'o.uuid = m.uuid', array('title','uuid')) ->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')); @@ -431,8 +449,7 @@ class Admin_DownController extends Zend_Controller_Action ->where('o.uuid = m.uuid and (o.status=0 or o.status=5)'); if(!empty($search) && !empty($keyword)) { - $select ->Where('m.title like ?','%'.$keyword.'%'); - $select ->Where('m.title_en like ?','%'.$keyword.'%'); + $select ->Where('m.title like ? ','%'.$keyword.'%'); $this->view->title='“'.$keyword.'”的搜索结果 :'; } $select ->group('m.title') @@ -453,7 +470,7 @@ class Admin_DownController extends Zend_Controller_Action elseif($show) { $select=$this->db->select(); - $select->from('dataorder as o',array('id','ts_created','offlineappid')) + $select->from('dataorder as o',array('ts_created')) ->join('metadata as m', 'o.uuid = m.uuid', array('title','uuid')) ->join('users as u', 'o.userid=u.id',array('id as userid','username','realname')) ->where('m.uuid = ? and (o.status=0 or o.status=5)', $show) diff --git a/application/admin/views/scripts/down/offline.phtml b/application/admin/views/scripts/down/offline.phtml index 37a1e811..7e47f39b 100644 --- a/application/admin/views/scripts/down/offline.phtml +++ b/application/admin/views/scripts/down/offline.phtml @@ -49,7 +49,11 @@