php scheduler,scheduler.php

"本文介绍了如何使用GOScheduler在PHP中创建一个任务调度器,通过定义多个任务,如deliver、vod_event等,按照每小时、每天等不同频率执行特定的业务操作,如教师直播通知、课程同步等。"
摘要由CSDN通过智能技术生成

require_once __DIR__ . '/vendor/autoload.php';

use GO\Scheduler;

$scheduler = new Scheduler();

$script = __DIR__ . '/console.php';

$bin = '/usr/local/bin/php';

$scheduler->php($script, $bin, ['--task' => 'deliver', '--action' => 'main'])

->at('*/3 * * * *');

$scheduler->php($script, $bin, ['--task' => 'vod_event', '--action' => 'main'])

->at('*/5 * * * *');

$scheduler->php($script, $bin, ['--task' => 'sync_learning', '--action' => 'main'])

->at('*/7 * * * *');

$scheduler->php($script, $bin, ['--task' => 'teacher_live_notice', '--action' => 'consume'])

->at('*/10 * * * *');

$scheduler->php($script, $bin, ['--task' => 'point_gift_deliver', '--action' => 'main'])

->at('*/11 * * * *');

$scheduler->php($script, $bin, ['--task' => 'server_monitor', '--action' => 'main'])

->at('*/12 * * * *');

$scheduler->php($script, $bin, ['--task' => 'close_trade', '--action' => 'main'])

->at('*/13 * * * *');

$scheduler->php($script, $bin, ['--task' => 'notice', '--action' => 'main'])

->everyMinute();

$scheduler->php($script, $bin, ['--task' => 'close_order', '--action' => 'main'])

->hourly(3);

$scheduler->php($script, $bin, ['--task' => 'refund', '--action' => 'main'])

->hourly(7);

$scheduler->php($script, $bin, ['--task' => 'sync_course_index', '--action' => 'main'])

->hourly(11);

$scheduler->php($script, $bin, ['--task' => 'sync_group_index', '--action' => 'main'])

->hourly(17);

$scheduler->php($script, $bin, ['--task' => 'sync_user_index', '--action' => 'main'])

->hourly(23);

$scheduler->php($script, $bin, ['--task' => 'sync_course_score', '--action' => 'main'])

->hourly(29);

$scheduler->php($script, $bin, ['--task' => 'clean_log', '--action' => 'main'])

->daily(3, 3);

$scheduler->php($script, $bin, ['--task' => 'unlock_user', '--action' => 'main'])

->daily(3, 7);

$scheduler->php($script, $bin, ['--task' => 'revoke_vip', '--action' => 'main'])

->daily(3, 11);

$scheduler->php($script, $bin, ['--task' => 'sitemap', '--action' => 'main'])

->daily(4, 3);

$scheduler->php($script, $bin, ['--task' => 'teacher_live_notice', '--action' => 'provide'])

->daily(4, 7);

$scheduler->php($script, $bin, ['--task' => 'optimize_table', '--action' => 'main'])

->weekly(6, 5, 3);

$scheduler->run();

一键复制

编辑

Web IDE

原始数据

按行查看

历史

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值