#434, 实现邮件发送判断

This commit is contained in:
wlx 2012-12-06 05:48:55 +00:00
parent f4251437db
commit ed5269a182
1 changed files with 9 additions and 4 deletions

View File

@ -1110,9 +1110,10 @@ class DataController extends Zend_Controller_Action
$userid = $user->id; $userid = $user->id;
} }
$testsql="select id from onlineapp where userid='$userid' and uuid='$uuid' order by id desc"; $testsql="select id,has_send_mail from onlineapp where userid='$userid' and uuid='$uuid' order by id desc";
$result=$this->db->query($testsql); $result=$this->db->query($testsql);
$rows = $result->fetch(); $rows = $result->fetch();
$has_send_mail=$rows['has_send_mail'];
if (empty($rows['id'])) if (empty($rows['id']))
{ {
$this->_redirect('/data/'.$uuid); $this->_redirect('/data/'.$uuid);
@ -1136,7 +1137,8 @@ class DataController extends Zend_Controller_Action
$sql="update dataorder set onlineappid='$onlineappid',ts_approved=now() where id='{$row['id']}'"; $sql="update dataorder set onlineappid='$onlineappid',ts_approved=now() where id='{$row['id']}'";
try {$this->db->exec($sql);} catch (Exception $e) {} try {$this->db->exec($sql);} catch (Exception $e) {}
} }
} }
$this->view->username='westdc'.Zend_Auth::getInstance()->getIdentity()->id; $this->view->username='westdc'.Zend_Auth::getInstance()->getIdentity()->id;
$sql=$this->db->quoteInto("select o.* from onlineresource o left join metadata m on o.uuid=m.uuid where m.datatype=0 and m.uuid=?",$uuid); $sql=$this->db->quoteInto("select o.* from onlineresource o left join metadata m on o.uuid=m.uuid where m.datatype=0 and m.uuid=?",$uuid);
$rows=$this->db->fetchAll($sql); $rows=$this->db->fetchAll($sql);
@ -1247,7 +1249,7 @@ class DataController extends Zend_Controller_Action
$sql="insert into dataorder (userid,uuid,ts_created) values(?,?,now())"; $sql="insert into dataorder (userid,uuid,ts_created) values(?,?,now())";
$this->db->query($sql,array($userid,$uuid)); $this->db->query($sql,array($userid,$uuid));
}*/ }*/
if (!empty($ftpurls) && ($updateftp || $updateftp1)) if (!empty($ftpurls) && ($updateftp || $updateftp1) && !$has_send_mail)
{ {
$data = array( $data = array(
"uuid"=>$uuid, "uuid"=>$uuid,
@ -1266,6 +1268,9 @@ class DataController extends Zend_Controller_Action
$mail->addTo($user->email); $mail->addTo($user->email);
$mail->setSubject($mailtp->getSubject()); $mail->setSubject($mailtp->getSubject());
@$mail->send(); @$mail->send();
$sql="update onlineapp set has_send_mail=true where id=?";
$sth=$this->db->prepare($sql);
$sth->execute(array($onlineappid));
} }
} }
/* /*