deploy: auto commit server changes 2026-06-11 20:44:36
This commit is contained in:
@@ -22,8 +22,9 @@ class KbConsume extends Command
|
||||
protected function execute(Input $input, Output $output)
|
||||
{
|
||||
$batch = max(1, (int) $input->getOption('batch'));
|
||||
KbSyncService::markLotteryBackfillJobs($batch);
|
||||
KbSyncService::markMatchBackfillJobs($batch);
|
||||
KbSyncService::markArticleBackfillJobs($batch);
|
||||
KbSyncService::markLotteryBackfillJobs($batch);
|
||||
|
||||
$jobs = AiKbSyncJob::where('status', AiKbSyncJob::STATUS_PENDING)
|
||||
->where('scheduled_at', '<=', time())
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\command;
|
||||
|
||||
use app\common\service\ai\KbRedisQueueService;
|
||||
use think\console\Command;
|
||||
use think\console\Input;
|
||||
use think\console\Output;
|
||||
use think\console\input\Option;
|
||||
|
||||
class KbEnqueueRecent extends Command
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('kb:enqueue-recent')
|
||||
->setDescription('扫描最近更新内容并写入AI知识库Redis队列')
|
||||
->addOption('limit', null, Option::VALUE_OPTIONAL, '每个来源最多扫描数量', 1000)
|
||||
->addOption('minutes', null, Option::VALUE_OPTIONAL, '扫描最近多少分钟更新的数据', 30);
|
||||
}
|
||||
|
||||
protected function execute(Input $input, Output $output)
|
||||
{
|
||||
$limit = max(1, (int) $input->getOption('limit'));
|
||||
$minutes = max(1, (int) $input->getOption('minutes'));
|
||||
$summary = KbRedisQueueService::enqueueRecent($limit, $minutes);
|
||||
|
||||
foreach ($summary['targets'] as $label => $target) {
|
||||
$output->writeln(sprintf(
|
||||
'[kb:enqueue-recent] %s scanned=%d queued=%d deduped=%d',
|
||||
$label,
|
||||
(int) $target['scanned'],
|
||||
(int) $target['queued'],
|
||||
(int) $target['deduped']
|
||||
));
|
||||
}
|
||||
|
||||
$output->writeln(sprintf(
|
||||
'[kb:enqueue-recent] stream=%s scanned=%d queued=%d deduped=%d limit=%d minutes=%d',
|
||||
$summary['stream'],
|
||||
(int) $summary['scanned'],
|
||||
(int) $summary['queued'],
|
||||
(int) $summary['deduped'],
|
||||
(int) $summary['limit'],
|
||||
(int) $summary['minutes']
|
||||
));
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,15 @@ class KbRebuild extends Command
|
||||
}
|
||||
}
|
||||
|
||||
KbSyncService::markLotteryBackfillJobs();
|
||||
if (in_array('article', $targets, true)) {
|
||||
KbSyncService::markArticleBackfillJobs();
|
||||
}
|
||||
if (in_array('match', $targets, true)) {
|
||||
KbSyncService::markMatchBackfillJobs();
|
||||
}
|
||||
if (in_array('lottery', $targets, true)) {
|
||||
KbSyncService::markLotteryBackfillJobs();
|
||||
}
|
||||
$output->writeln(sprintf('[kb:rebuild] success=%d failed=%d', $summary['success'], $summary['failed']));
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user