edit emailTemplate duplicate
This commit is contained in:
parent
c705293d85
commit
658e1d9670
|
@ -33,8 +33,14 @@ class Template implements ServiceManagerAwareInterface
|
||||||
return $rs->fetchAll(\PDO::FETCH_ASSOC);
|
return $rs->fetchAll(\PDO::FETCH_ASSOC);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function insert($data,$id=0)
|
//插入邮件模板
|
||||||
|
public function insert($data)
|
||||||
{
|
{
|
||||||
|
$temp=$this->fetch($data['template']);
|
||||||
|
if(isset($temp['id']) && is_numeric($temp['id']) && $temp['id']>0)
|
||||||
|
{
|
||||||
|
return '该邮件模板标识已经存在,请更换标识!';
|
||||||
|
}
|
||||||
|
|
||||||
$dbhService = $this->serviceManager->get('Db');
|
$dbhService = $this->serviceManager->get('Db');
|
||||||
$dbh = $dbhService->getDbh();
|
$dbh = $dbhService->getDbh();
|
||||||
|
@ -44,8 +50,6 @@ class Template implements ServiceManagerAwareInterface
|
||||||
$data['subject']='未命名模板';
|
$data['subject']='未命名模板';
|
||||||
}
|
}
|
||||||
|
|
||||||
// 替换邮件内容中的 ' 为 ''
|
|
||||||
$data['body']=str_replace("'","''",$data['body']);
|
|
||||||
|
|
||||||
$rs = $dbh->insert('emailtext',$data,1);
|
$rs = $dbh->insert('emailtext',$data,1);
|
||||||
return $rs;
|
return $rs;
|
||||||
|
@ -60,13 +64,19 @@ class Template implements ServiceManagerAwareInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
//更新邮件模板
|
//更新邮件模板
|
||||||
public function update($table,$data,$id)
|
public function update($data,$id)
|
||||||
{
|
{
|
||||||
|
$temp=$this->fetch($data['template']);
|
||||||
|
if(isset($temp['id']) && is_numeric($temp['id']) && $temp['id']>0)
|
||||||
|
{
|
||||||
|
if($id!=$temp['id'])
|
||||||
|
return '该邮件模板标识已经存在,请更换标识!';
|
||||||
|
}
|
||||||
|
|
||||||
$dbhService = $this->serviceManager->get('Db');
|
$dbhService = $this->serviceManager->get('Db');
|
||||||
$dbh = $dbhService->getDbh();
|
$dbh = $dbhService->getDbh();
|
||||||
|
|
||||||
// 替换邮件内容中的 ' 为 ''
|
|
||||||
$data['body']=str_replace("'","''",$data['body']);
|
|
||||||
$rs = $dbh->update('emailtext',$data,"id=$id",1);
|
$rs = $dbh->update('emailtext',$data,"id=$id",1);
|
||||||
return $rs;
|
return $rs;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue