对单条已接收数据发送email

This commit is contained in:
wlx 2012-05-21 11:34:20 +00:00
parent 1492b6dccf
commit 4a95ae4d8a
1 changed files with 33 additions and 2 deletions

View File

@ -744,6 +744,37 @@ class Admin_ReviewController extends Zend_Controller_Action
if($this->changestatus($ids,1)) if($this->changestatus($ids,1))
{ {
//仅对单条数据发送email信息并且注册为数据作者
if (is_numeric($ids))
{
$sql="select distinct u.email,m.title,m.uuid from mdstatus s left join metadata m on s.uuid=m.uuid
left join mdauthor a on s.uuid=a.uuid left join users u on a.userid=u.id where s.id=? order by u.email";
$rs=$this->db->query($sql,array($ids));
$rows=$rs->fetchAll($rs);
if ($rows)
{
//有数据作者
$mail=array();
foreach ($rows as $row)
{
$mail[]=$row['email'];
}
$title=$rows[0]['title'];
$uuid=$rows[0]['uuid'];
//send email
$mail=new WestdcMailer($this->view->config->smtp);
$mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
$mailtp=new EmailText($this->db,"review-new-accept",array(
'uuid' => $iso->uuid,
'title'=> $iso->resTitle
));
$mail->setBodyText($mailtp->getBody());
$mail->setSubject($mailtp->getSubject());
$mail->addTo($mail);
$mail->addCC($this->view->config->service->email);
$mail->send();
}
}
$this->messenger->addMessage('操作成功!'); $this->messenger->addMessage('操作成功!');
$this->_redirect("/admin/review/draft"); $this->_redirect("/admin/review/draft");
} }
@ -764,7 +795,7 @@ class Admin_ReviewController extends Zend_Controller_Action
$sql = "select m.id,md.title,md.uuid,u.username,u.realname,m.status,m.ts_created from mdstatus m $sql = "select m.id,md.title,md.uuid,u.username,u.realname,m.status,m.ts_created from mdstatus m
right join metadata md on md.uuid=m.uuid right join metadata md on md.uuid=m.uuid
left join users u on u.id=m.userid left join users u on u.id=m.userid
where status=0 $searchjoin"; where status=0 $searchjoin order by m.ts_created desc";
$re = $this->db->query($sql); $re = $this->db->query($sql);
$rows = $re->fetchAll(); $rows = $re->fetchAll();