1
This commit is contained in:
@@ -136,5 +136,57 @@ class Email extends Controller{
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送模板邮件
|
||||
*/
|
||||
public function pushEmailOnTemplate(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'email'=>'require',
|
||||
'content'=>'require',
|
||||
'article_id'=>'require'
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$article_info = $this->article_obj->where('article_id',$data['article_id'])->find();
|
||||
$journal_info = $this->journal_obj->where('journal_id',$article_info['journal_id'])->find();
|
||||
|
||||
|
||||
$maidata['email'] = $data['email'];
|
||||
$maidata['title'] = $journal_info['title'];
|
||||
$maidata['content'] = $data['content'];
|
||||
$maidata['tmail'] = $journal_info['email'];
|
||||
$maidata['tpassword'] = $journal_info['epassword'];
|
||||
$maidata['article_id'] = $data['article_id'];
|
||||
$maidata['attachmentFile'] = (isset($data['attachment'])&&$data['attachment']!='')?ROOT_PATH . 'public' . DS . $data['attachment']:'';
|
||||
|
||||
Queue::push('app\api\job\mail@tgpu', $maidata, "tmail");
|
||||
|
||||
return jsonSuccess([]);
|
||||
|
||||
}
|
||||
|
||||
public function tttt(){
|
||||
$str = "home".DS."ds".DS."12312321.jpg";
|
||||
echo substr($str,strrpos($str,DS)+1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 上传文章的文件
|
||||
*/
|
||||
public function up_enclosure_file() {
|
||||
$file = request()->file("enclosure");
|
||||
if ($file) {
|
||||
$info = $file->move(ROOT_PATH . 'public' . DS . 'enclosure');
|
||||
if ($info) {
|
||||
return json(['code' => 0, 'upurl' => str_replace("\\", "/", $info->getSaveName())]);
|
||||
} else {
|
||||
return json(['code' => 1, 'msg' => $file->getError()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user