diff --git a/application/admin/controllers/WatermdController.php b/application/admin/controllers/WatermdController.php index abc83422..cc2e8c67 100644 --- a/application/admin/controllers/WatermdController.php +++ b/application/admin/controllers/WatermdController.php @@ -162,6 +162,9 @@ class Admin_WatermdController extends Zend_Controller_Action { $sql="select uuid,data from metadata where istemplate = 'n'"; $rows=$this->wdb->fetchAll($sql); + $this->view->deal=array(); + $sql="select update_filesize();"; + $this->db->exec($sql); foreach($rows as $k=>$row) { //do the replace @@ -173,24 +176,21 @@ class Admin_WatermdController extends Zend_Controller_Action $title_key=$xpath->query("//Metadata/dataIdInfo/idCitation/resTitle"); $title=$title_key->item(0)->nodeValue; $transize_path=$xpath->query("//Metadata/distInfo/distTranOps/transSize"); - $sql="select sum(file_size) as fsize from westdc_fileinfo where meta_uuid = ?"; + $sql="select filesize from metadata where uuid = ?"; $this->db->setFetchMode(Zend_Db::FETCH_OBJ); $row=$this->db->fetchRow($sql,array($uuid)); - //转换单位为MB - $msize=round($row->fsize/(1024*1024),2); - if($msize>10){ - $msize=round($size/(1024*1024),1); - } - $transize_path->item(0)->nodeValue=msize; - $new_data = $dom->saveXML($root->item(0)); + $transize_path->item(0)->nodeValue=$row->filesize; + $new_data = $dom->saveXML(); //防止错误 if (!empty($new_data)) { - $sql="update metadata set data=? where uuid=?"; - $this->wdb->query($sql,array($new_data,$uuid)); + $sql="update metadata set data=? where uuid='$uuid'"; + if ($this->wdb->exec($this->wdb->quoteInto($sql,$new_data))) + { $deal['uuid']=$uuid; $deal['title']=$title; $this->view->deal[]=$deal; + } } } }