deploy: auto commit server changes 2026-06-11 20:44:36

This commit is contained in:
hajimi
2026-06-11 20:44:36 +08:00
parent 9fb80f951a
commit e17a9832af
11 changed files with 1195 additions and 23 deletions
+2 -1
View File
@@ -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;
}
}
+9 -1
View File
@@ -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;
}