Files
journal/application/api/job/mail.php
wangjinlei 49f170a778 20201112
2021-12-20 17:12:23 +08:00

59 lines
1.4 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace app\api\job;
use think\Db;
use think\queue\Job;
class mail {
//put your code here
public function fire(Job $job, $data) {
$res = $this->send($data);
$job->delete();
// if($res){
// $job->delete();
// }else{
// if($job->attempts()>3){
// // 第1种处理方式重新发布任务,该任务延迟10秒后再执行
// //$job->release(10);
// // 第2种处理方式原任务的基础上1分钟执行一次并增加尝试次数
// //$job->failed();
// // 第3种处理方式删除任务
// $job->delete();
// }
// }
}
public function propa(Job $job, $data){
$res = $this->push($data);
$job->delete();
}
/**
* 发送邮件的逻辑
* @param type $data
*/
public function send($data){
$r = sendEmail($data['email'],$data['title'],$data['title'],$data['content'],$data['tmail'],$data['tpassword']);
if($r['status']==1){
return true;
}else{
return false;
}
}
public function push($data){
$res = aliemail($data['email'], $data['title'], $data['content']);
if($res){
return true;
}else{
return false;
}
}
}