diff --git a/application/default/controllers/ArchivesController.php b/application/default/controllers/ArchivesController.php index 43916d26..6b8241c4 100644 --- a/application/default/controllers/ArchivesController.php +++ b/application/default/controllers/ArchivesController.php @@ -180,7 +180,9 @@ class ArchivesController extends Zend_Controller_Action $time = date("Y-m-d H:i:s",time()); - $sql = "SELECT n.*,c.title as typename,c.code,u.realname as author,ct.uuid as mduuid FROM ".$News->tbl_archives." n + $sql = "SELECT + n.*,c.title as typename,c.code,u.realname as author,ct.uuid as mduuid + FROM ".$News->tbl_archives." n left join ".$News->tbl_catalog." ct on ct.aid=n.id left join ".$News->tbl_categorys." c ON ct.cid=c.id LEFT JOIN users u ON n.userid=u.id @@ -199,9 +201,11 @@ class ArchivesController extends Zend_Controller_Action if(!empty($row['mduuid'])) { - $sql = "SELECT uuid,title FROM metadata WHERE uuid='{$row['mduuid']}'"; + $sql = "SELECT md.uuid,md.title FROM ar_catalog ct + LEFT JOIN metadata md ON ct.uuid=md.uuid + WHERE ct.aid=$archive"; $sth = $this->db->query($sql); - $mdinfo = $sth->fetch(); + $mdinfo = $sth->fetchAll(); } $this->view->mdinfo = $mdinfo; diff --git a/application/default/controllers/AuthorController.php b/application/default/controllers/AuthorController.php index bcbd311a..3f860399 100644 --- a/application/default/controllers/AuthorController.php +++ b/application/default/controllers/AuthorController.php @@ -1267,12 +1267,15 @@ class AuthorController extends Zend_Controller_Action $wheresql = " WHERE ".join(" AND ",$wheresql); } - $sql = "SELECT arc.*,c.id as cid,u.realname,md.title as mdtitle,md.uuid as mduuid FROM ".$News->tbl_archives." arc + $sql = "SELECT arc.id,arc.title,arc.description,arc.ts_published + ,c.id as cid,u.realname + ,count(arc.id) as datacount + FROM ".$News->tbl_archives." arc LEFT JOIN ".$News->tbl_catalog." ct ON arc.id=ct.aid LEFT JOIN ".$News->tbl_categorys." c ON ct.cid=c.id LEFT JOIN users u ON arc.userid=u.id - LEFT JOIN metadata md ON ct.uuid=md.uuid $wheresql + GROUP BY arc.id,c.id,u.realname ORDER BY arc.ts_published DESC"; @@ -1367,7 +1370,7 @@ class AuthorController extends Zend_Controller_Action $data['title'] = trim($this->_request->getParam('title')); $data['keyword'] = trim($this->_request->getParam('keyword')); $data['body'] = trim($this->_request->getParam('body')); - $uuid = trim($this->_request->getParam('uuid')); + $uuid = $this->_request->getParam('uuid'); //对参数进行预处理 foreach($data as $k=>$v) @@ -1430,7 +1433,29 @@ class AuthorController extends Zend_Controller_Action return true; } - if(!preg_match("/^[0-9A-Za-z]{8}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{12}$/",$uuid)) + if(is_array($uuid)) + { + if(count($uuid)<1) + { + $msg['status'] = 0; + $msg['error'] = '参数错误,请重试'; + $this->getResponse()->setHeader('Content-Type', 'application/json')->appendBody(Zend_Json::encode($msg)); + return true; + } + + foreach($uuid as $v) + { + if(!preg_match("/^[0-9A-Za-z]{8}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{12}$/",$v)) + { + $msg['status'] = 0; + $msg['error'] = '参数错误,请重试'; + $this->getResponse()->setHeader('Content-Type', 'application/json')->appendBody(Zend_Json::encode($msg)); + return true; + } + } + } + + else if(!preg_match("/^[0-9A-Za-z]{8}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{12}$/",$uuid)) { $msg['status'] = 0; $msg['error'] = '参数错误,请重试'; @@ -1485,6 +1510,7 @@ class AuthorController extends Zend_Controller_Action $this->getResponse()->setHeader('Content-Type', 'application/json')->appendBody(Zend_Json::encode($msg)); return true; } + $updated = $News->updateArchive($aid,$data,$dataNewsCategoryID,$keyword,$uuid); if($updated) { diff --git a/application/default/views/scripts/archives/archive.phtml b/application/default/views/scripts/archives/archive.phtml index b568f6a8..bae635c4 100644 --- a/application/default/views/scripts/archives/archive.phtml +++ b/application/default/views/scripts/archives/archive.phtml @@ -41,8 +41,9 @@ $this->headMeta()->appendName('description', mb_substr($this->infos['description