Files
fdesk/app/process/Emails.php
T
2025-12-26 14:12:54 +08:00

81 lines
2.5 KiB
PHP

<?php
namespace app\process;
use app\common\utils\email\Mailbox;
use Workerman\Crontab\Crontab;
use app\common\utils\email\Emails as EmailsUtils;
class Emails
{
public function onWorkerStart()
{
// // 拉取新邮件
// new Crontab('0 */30 * * * *', function(){
// $email = new EmailsUtils();
// $email->uids();
// });
// // 邮件详情
// new Crontab('0 */35 * * * *', function(){
// $email = new EmailsUtils();
// $email->details();
// });
// // 邮件处理
// new Crontab('0 */40 * * * *', function(){
// $email = new EmailsUtils();
// $email->process();
// });
if (getenv('ENVIRONMENT') === 'master') {
// 拉取新邮件 - 每小时的第20分钟0秒执行
new Crontab('0 */20 * * * *', function(){
$email = new EmailsUtils();
$email->uids();
});
// 邮件详情 - 每小时的第25分钟0秒执行
new Crontab('0 */25 * * * *', function(){
$email = new EmailsUtils();
$email->details();
});
// 邮件处理 - 每小时的第30分钟0秒执行
new Crontab('0 */30 * * * *', function(){
$email = new EmailsUtils();
$email->process();
});
// 邮件分派 - 每小时的第35分钟0秒执行
new Crontab('0 */35 * * * *', function(){
$email = new EmailsUtils();
$email->fenpai();
});
//-------------多邮箱处理----------------
// 拉取新邮件uid - 每小时的第40分钟0秒执行
new Crontab('0 */40 * * * *', function(){
$email = new Mailbox();
$email->mailbox();
});
// 拉取邮件详情 - 每小时的第35分钟0秒执行
new Crontab('0 */45 * * * *', function(){
$email = new Mailbox();
$email->pullDetails();
});
// 清洗数据 - 每小时的第55分钟0秒执行
new Crontab('0 */55 * * * *', function(){
$email = new Mailbox();
$email->processMailbox();
});
// 邮件分派 - 每小时的第10分钟0秒执行
new Crontab('0 */10 * * * *', function(){
$email = new Mailbox();
$email->fenpaiMailbox();
});
}
}
}