src/AppBundle/Command/SchedulerCommand.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace AppBundle\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class SchedulerCommand extends BaseCommand
{
protected function configure()
{
$this->setName('util:scheduler')
->setDescription('执行定时任务');
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$logger = $this->getContainer()->get('biz')->offsetGet('logger');
$logger->info('Crontab:开始执行定时任务');
$this->setDisableWebCrontab();
$this->initServiceKernel();
$this->getSchedulerService()->execute();
$logger->info('Crontab:定时任务执行完毕');
}
protected function setDisableWebCrontab()
{
$setting = $this->getSettingService()->get('magic', array());
if (empty($setting['disable_web_crontab'])) {
$setting['disable_web_crontab'] = 1;
$this->getSettingService()->set('magic', $setting);
}
}
protected function getSchedulerService()
{
return $this->getServiceKernel()->createService('Scheduler:SchedulerService');
}
protected function getSettingService()
{
return $this->getServiceKernel()->createService('System:SettingService');
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。