为日志收集系统增加配置项,用于控制每个收集器的启动和关闭状态,提供更灵活的日志收集管理功能。
2025-06-23 01:45
在 kku_game_configs 表中添加了5个日志收集器的开关配置项:
user_log.collector.fund.enabled - 资金日志收集器开关user_log.collector.item.enabled - 物品日志收集器开关user_log.collector.farm_harvest.enabled - 农场收获日志收集器开关user_log.collector.farm_upgrade.enabled - 农场升级日志收集器开关user_log.collector.point.enabled - 积分日志收集器开关所有配置项默认为启用状态(值为1),类型为布尔值。
在 GameConfigService 中添加了收集器状态管理方法:
isCollectorEnabled(string $collectorName): bool - 检查指定收集器是否启用getCollectorStates(): array - 获取所有收集器的启用状态setCollectorStates(array $states): bool - 批量设置收集器启用状态在 GameConfigLogic 中添加了:
setBool(string $key, bool $value): bool - 设置布尔值配置修改 UserLogCollectorManager 类:
collectAll() 方法中增加收集器启用状态检查collectByName() 方法中增加收集器启用状态检查getCollectorsInfo() 方法中增加启用状态信息修改 CollectUserLogsCommand 类:
通过现有的 GameSystemConfigController 可以:
php artisan game:collect-user-logs --info
访问:http://kku_laravel.local.gd/admin/game-system-configs 搜索 "user_log.collector" 可以找到所有收集器配置项
// 检查单个收集器状态
$enabled = GameConfigService::isCollectorEnabled('fund');
// 获取所有收集器状态
$states = GameConfigService::getCollectorStates();
// 批量设置收集器状态
GameConfigService::setCollectorStates([
'fund' => true,
'item' => false,
'point' => true
]);