Files
toolbox/app/Console/Commands/GitMonitorCacheCommand.php
2026-01-19 14:21:15 +08:00

30 lines
758 B
PHP

<?php
namespace App\Console\Commands;
use App\Services\GitMonitorService;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;
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)) {
Log::warning('未获取到任何 release 版本信息,请检查配置。');
return;
}
Log::info(sprintf(
'已缓存 %d 个仓库的 release 分支信息。',
count($cache['repositories'] ?? [])
));
}
}