调整表结构,移除EmailText使用
This commit is contained in:
parent
748a6f7f53
commit
b2d402ee6b
|
@ -36,12 +36,12 @@ class Admin_SysController extends Zend_Controller_Action
|
||||||
if($ac=='add' && !empty($submit))
|
if($ac=='add' && !empty($submit))
|
||||||
{
|
{
|
||||||
$title = $this->_request->getParam('title');
|
$title = $this->_request->getParam('title');
|
||||||
$description = $this->_request->getParam('description');
|
$template = $this->_request->getParam('template');
|
||||||
$body = $this->_request->getParam('body');
|
$body = $this->_request->getParam('body');
|
||||||
|
|
||||||
if(empty($title)) $title=='未命名模板';
|
if(empty($title)) $title=='未命名模板';
|
||||||
|
|
||||||
$sql = "insert into emailtext (title,description,content,ts_create) values ('$title','$description','$body','".time()."')";
|
$sql = "insert into emailtext (subject,template,body) values ('$title','$template','$body')";
|
||||||
|
|
||||||
try{
|
try{
|
||||||
if($this->db->exec($sql)>0)
|
if($this->db->exec($sql)>0)
|
||||||
|
@ -60,10 +60,10 @@ class Admin_SysController extends Zend_Controller_Action
|
||||||
if(!empty($submit))
|
if(!empty($submit))
|
||||||
{
|
{
|
||||||
$title = $this->_request->getParam('title');
|
$title = $this->_request->getParam('title');
|
||||||
$description = $this->_request->getParam('description');
|
$template = $this->_request->getParam('template');
|
||||||
$body = $this->_request->getParam('body');
|
$body = $this->_request->getParam('body');
|
||||||
|
|
||||||
$sql = "update emailtext set title='$title',description='$description',content='$body' where id='$id'";
|
$sql = "update emailtext set subject='$title',template='$template',body='$body',ts_changed=now() where id='$id'";
|
||||||
|
|
||||||
try{
|
try{
|
||||||
if($this->db->exec($sql)>0)
|
if($this->db->exec($sql)>0)
|
||||||
|
@ -77,13 +77,9 @@ class Admin_SysController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
$sql = "select * from emailtext where id='$id'";
|
$sql = "select * from emailtext where id='$id'";
|
||||||
|
|
||||||
$rs = $this->db->query($sql);
|
$rs = $this->db->query($sql);
|
||||||
|
|
||||||
$rows = $rs->fetch();
|
$rows = $rs->fetch();
|
||||||
|
|
||||||
$this->view->info = $rows;
|
$this->view->info = $rows;
|
||||||
|
|
||||||
$this->_helper->viewRenderer('emailtextedit');
|
$this->_helper->viewRenderer('emailtextedit');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,24 +90,11 @@ class Admin_SysController extends Zend_Controller_Action
|
||||||
if(!empty($submit))
|
if(!empty($submit))
|
||||||
{
|
{
|
||||||
try{
|
try{
|
||||||
$mailbody=new emailtext();
|
$subject = $this->_request->getParam('subject');
|
||||||
$mailbody->db = $this->db;
|
$email = $this->_request->getParam('email');
|
||||||
$mailbody->tmpid = $id;
|
$body = $this->_request->getParam('body');
|
||||||
$mailbody->data = array(
|
$body=str_replace("[username]",$this->_request->getParam('user'),$body);
|
||||||
'user' => $this->_request->getParam('user')
|
if(empty($subject) || empty($email))
|
||||||
);
|
|
||||||
$body=$mailbody->loadtmp();
|
|
||||||
if($body){
|
|
||||||
$body;
|
|
||||||
}else{
|
|
||||||
$this->messenger->addMessage('模板加载出错');
|
|
||||||
$this->_redirect('/admin/sys/emailtext/ac/test/id/'.$id);
|
|
||||||
}
|
|
||||||
|
|
||||||
$subject = $this->_request->getParam('title');
|
|
||||||
$email = $this->_request->getParam('email');
|
|
||||||
|
|
||||||
if(empty($subject)||empty($email))
|
|
||||||
{
|
{
|
||||||
$this->messenger->addMessage('请填写测试邮件发送信息');
|
$this->messenger->addMessage('请填写测试邮件发送信息');
|
||||||
$this->_redirect('/admin/sys/emailtext/ac/test/id/'.$id);
|
$this->_redirect('/admin/sys/emailtext/ac/test/id/'.$id);
|
||||||
|
@ -120,7 +103,6 @@ class Admin_SysController extends Zend_Controller_Action
|
||||||
|
|
||||||
$mail->setBodyText($body);
|
$mail->setBodyText($body);
|
||||||
$mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
|
$mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
|
||||||
$body.=date("H:i:s",time());
|
|
||||||
$mail->addTo($email);
|
$mail->addTo($email);
|
||||||
$mail->setSubject($subject);
|
$mail->setSubject($subject);
|
||||||
|
|
||||||
|
@ -134,12 +116,14 @@ class Admin_SysController extends Zend_Controller_Action
|
||||||
}catch(Exception $e){
|
}catch(Exception $e){
|
||||||
$this->messenger->addMessage('测试邮件发送失败'.$e->getMessage());
|
$this->messenger->addMessage('测试邮件发送失败'.$e->getMessage());
|
||||||
$this->_redirect('/admin/sys/emailtext/ac/test/id/'.$id);
|
$this->_redirect('/admin/sys/emailtext/ac/test/id/'.$id);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->view->id = $id;
|
$sql = "select * from emailtext where id='$id'";
|
||||||
|
$rs = $this->db->query($sql);
|
||||||
|
$rows = $rs->fetch();
|
||||||
|
$this->view->info = $rows;
|
||||||
$this->_helper->viewRenderer('emailtexttest');
|
$this->_helper->viewRenderer('emailtexttest');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +131,7 @@ class Admin_SysController extends Zend_Controller_Action
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sql = "select id,title,userid,ts_create,description,usetimes from emailtext";
|
$sql = "select id,subject,template,ts_created,ts_changed from emailtext";
|
||||||
$rs = $this->db->query($sql);
|
$rs = $this->db->query($sql);
|
||||||
$rows = $rs->fetchAll();
|
$rows = $rs->fetchAll();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue