修复新数据提交错误时的错误处理

This commit is contained in:
wlx 2012-10-16 02:12:32 +00:00
parent 9ff5f24b0e
commit 4d568916f3
1 changed files with 7 additions and 6 deletions

View File

@ -2844,8 +2844,8 @@ class Admin_DataController extends Zend_Controller_Action
$this->_helper->viewRenderer->setNoRender(); $this->_helper->viewRenderer->setNoRender();
$data = ""; $data = "";
$id = $this->_request->getParam('id');
try{ try{
$id = $this->_request->getParam('id');
if(empty($id) || !is_numeric($id)) if(empty($id) || !is_numeric($id))
{ {
$data = array("error"=>"参数错误"); $data = array("error"=>"参数错误");
@ -2887,7 +2887,6 @@ class Admin_DataController extends Zend_Controller_Action
//进入评审库 //进入评审库
$sql="insert into mdstatus (uuid,status,userid) select uuid,0,? from geonetworkmetadata where id=?"; $sql="insert into mdstatus (uuid,status,userid) select uuid,0,? from geonetworkmetadata where id=?";
$this->db->query($sql,array($u_id,$id)); $this->db->query($sql,array($u_id,$id));
//email to admin //email to admin
$mail=new WestdcMailer($this->view->config->smtp); $mail=new WestdcMailer($this->view->config->smtp);
$mail->setFrom($this->view->config->service->email,'西部数据中心服务组'); $mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
@ -2912,6 +2911,8 @@ class Admin_DataController extends Zend_Controller_Action
$this->jsonexit($data); $this->jsonexit($data);
return true; return true;
}catch(Exception $e) { }catch(Exception $e) {
$sql="delete from mdstatus where uuid in (select uuid from geonetworkmetadata where id=?)";
$this->db->query($sql,array($id));
$msg = "提交失败,请确认权限后重试"; $msg = "提交失败,请确认权限后重试";
if($this->debug>0) if($this->debug>0)
{$msg .= $e->getMessage();} {$msg .= $e->getMessage();}