This commit is contained in:
wangjinlei
2021-02-06 13:42:34 +08:00
parent e244529d34
commit d3b80b03c7

View File

@@ -4,6 +4,7 @@ namespace app\api\job;
use think\queue\Job; use think\queue\Job;
use think\Db; use think\Db;
use think\Queue;
/** /**
* Description of review * Description of review
@@ -37,23 +38,24 @@ class review {
} }
public function fire(Job $job, $data) { public function fire(Job $job, $data) {
$res = $this->checkrev($data); echo "Temporarily Out of Service";
// $res = $this->testemail($data);
if ($res) {
file_put_contents('/usr/local/1.txt', 'log_time:'.date('Y-m-d H:i:s').' success:'.$data['title'].PHP_EOL, FILE_APPEND);
$job->delete(); $job->delete();
} else { // $res = $this->checkrev($data);
if ($job->attempts() > 3) { // if ($res) {
file_put_contents('/usr/local/1.txt', 'log_time:'.date('Y-m-d H:i:s').' error:'.$data['title'].PHP_EOL, FILE_APPEND); // file_put_contents('/usr/local/1.txt', 'log_time:'.date('Y-m-d H:i:s').' success:'.$data['title'].PHP_EOL, FILE_APPEND);
// 第1种处理方式重新发布任务,该任务延迟10秒后再执行 // $job->delete();
//$job->release(10); // } else {
// 第2种处理方式原任务的基础上1分钟执行一次并增加尝试次数 // if ($job->attempts() > 3) {
//$job->failed(); // file_put_contents('/usr/local/1.txt', 'log_time:'.date('Y-m-d H:i:s').' error:'.$data['title'].PHP_EOL, FILE_APPEND);
// 第3种处理方式:删除任务 // // 第1种处理方式:重新发布任务,该任务延迟10秒后再执行
$job->delete(); // //$job->release(10);
} // // 第2种处理方式原任务的基础上1分钟执行一次并增加尝试次数
$job->delete(); // //$job->failed();
} // // 第3种处理方式删除任务
// $job->delete();
// }
// $job->delete();
// }
} }
public function testemail($data) { public function testemail($data) {