Files
toolbox/app/Console/Commands/GitMonitorCacheCommand.php
2025-12-18 10:18:25 +08:00

29 lines
723 B
PHP

<?php
namespace App\Console\Commands;
use App\Services\GitMonitorService;
use Illuminate\Console\Command;
class GitMonitorCacheCommand extends Command
{
protected $signature = 'git-monitor:cache';
protected $description = '刷新 release 版本缓存,保存到 configs 表';
public function handle(GitMonitorService $monitor): void
{
$cache = $monitor->refreshReleaseCache(true);
if (empty($cache)) {
$this->warn('未获取到任何 release 版本信息,请检查配置。');
return;
}
$this->info(sprintf(
'已缓存 %d 个仓库的 release 分支信息。',
count($cache['repositories'] ?? [])
));
}
}