This commit is contained in:
hajimi
2026-06-11 16:22:12 +08:00
parent 96efa1d905
commit 21aa11bf17
368 changed files with 2741 additions and 554 deletions
+18 -2
View File
@@ -31,6 +31,14 @@ use app\common\service\crontab\CrontabAlertService;
*/
class Crontab extends Command
{
protected const CRAWLER_MIGRATED_MESSAGE = 'crawler任务已迁移到Docker容器调度,请查看管理端爬虫任务日志';
protected const CRAWLER_MIGRATED_COMMANDS = [
'crawler',
'truth_social',
'fifa_worldcup_news',
];
protected const CRAWLER_DEFAULT_TIMEOUT = 600;
protected const CRAWLER_ACTION_TIMEOUTS = [
@@ -96,8 +104,8 @@ class Crontab extends Command
public static function start($item)
{
if ($item['command'] === 'crawler') {
self::startCrawler($item);
if (in_array($item['command'], self::CRAWLER_MIGRATED_COMMANDS, true)) {
self::skipMigratedCrawler($item);
return;
}
@@ -158,6 +166,14 @@ class Crontab extends Command
}
}
protected static function skipMigratedCrawler(array $item): void
{
CrontabModel::where('id', $item['id'])->update([
'last_time' => time(),
'error' => self::CRAWLER_MIGRATED_MESSAGE,
]);
}
protected static function startCrawler($item)
{
$crawlerDir = app()->getRootPath() . 'public/dongqiudi-crawler';