修复后台元数据发布时的xml解析以及搜索构建问题: westdc/westdc-zf1#24

This commit is contained in:
wlx 2015-12-21 23:38:39 +08:00
parent 450acf926c
commit c74735ec7e
1 changed files with 34 additions and 0 deletions

View File

@ -367,6 +367,23 @@ class ReviewListener implements Zend_EventManager_ListenerAggregate
if(is_numeric($id)) if(is_numeric($id))
{ {
//同步元数据
$sql = "select v.xml,m.uuid from mdversion v left join metadata m on m.uuid=v.uuid left join mdstatus ms on ms.uuid=m.uuid where ms.id=? order by v.ts_created desc limit 1";
$sth = $this->db->prepare($sql);
$sth->execute(array($id));
$row=$sth->fetch();
$iso=new ISO19115();
$iso->saveDB($this->db,$row['xml']);
//构建搜索
$sql="select * from xunsearch where uuid=?";
$sth = $this->db->prepare($sql);
$sth->execute(array($row['uuid']));
$data_search = $sth->fetch();
$search=new Search();
$search->update($data_search);
//发布正式版本 //发布正式版本
$sql = "UPDATE mdversion SET changelog=?,userid=? WHERE id in (select id from mdversion where uuid in (select uuid from mdstatus where id=?) order by ts_created desc limit 1)"; $sql = "UPDATE mdversion SET changelog=?,userid=? WHERE id in (select id from mdversion where uuid in (select uuid from mdstatus where id=?) order by ts_created desc limit 1)";
$this->db->query($sql,array('发布第一个正式版本 version 1.0',$userid,$id)); $this->db->query($sql,array('发布第一个正式版本 version 1.0',$userid,$id));
@ -394,6 +411,23 @@ class ReviewListener implements Zend_EventManager_ListenerAggregate
{ {
foreach($id as $v) foreach($id as $v)
{ {
//同步元数据
$sql = "select v.xml,m.uuid from mdversion v left join metadata m on m.uuid=v.uuid left join mdstatus ms on ms.uuid=m.uuid where ms.id=? order by v.ts_created desc limit 1";
$sth = $this->db->prepare($sql);
$sth->execute(array($v));
$row=$sth->fetch();
$iso=new ISO19115();
$iso->saveDB($this->db,$row['xml']);
//构建搜索
$sql="select * from xunsearch where uuid=?";
$sth = $this->db->prepare($sql);
$sth->execute(array($row['uuid']));
$data_search = $sth->fetch();
$search=new Search();
$search->update($data_search);
//发布正式版本 //发布正式版本
$sql = "UPDATE mdversion SET changelog=?,userid=? WHERE id in (select id from mdversion where uuid in (select uuid from mdstatus where id=?) order by ts_created desc limit 1)"; $sql = "UPDATE mdversion SET changelog=?,userid=? WHERE id in (select id from mdversion where uuid in (select uuid from mdstatus where id=?) order by ts_created desc limit 1)";
$this->db->query($sql,array('发布第一个正式版本 version 1.0',$userid,$v)); $this->db->query($sql,array('发布第一个正式版本 version 1.0',$userid,$v));