chore: 基本服务器版本完成

This commit is contained in:
2025-11-12 08:23:41 +08:00
parent 22016ac339
commit 58ad47d124
9 changed files with 2084 additions and 490 deletions

View File

@@ -0,0 +1,47 @@
import { getConfig, writeConfig } from './configService.js';
// 测试配置服务功能
const testConfigService = async () => {
try {
console.log('开始测试配置服务...');
// 读取配置
const config = await getConfig();
console.log('成功读取配置:', {
hasIndividualRankings: config.individualRankings?.length > 0,
hasTeamRankings: config.teamRankings?.length > 0,
hasSystemUsers: config.systemUsers?.length > 0,
hasDisplayConfig: !!config.displayConfig,
hasBattleEndTime: !!config.battleEndTime,
hasDrumConfig: !!config.drumConfig
});
// 写入配置(添加一个小的修改然后恢复)
const testKey = 'test_timestamp';
const originalValue = config[testKey];
config[testKey] = Date.now();
await writeConfig(config);
console.log('成功写入配置修改');
// 验证修改已保存
const updatedConfig = await getConfig();
console.log('修改验证成功:', updatedConfig[testKey] === config[testKey]);
// 恢复原始状态
if (originalValue === undefined) {
delete updatedConfig[testKey];
} else {
updatedConfig[testKey] = originalValue;
}
await writeConfig(updatedConfig);
console.log('成功恢复原始配置');
return { success: true };
} catch (error) {
console.error('配置服务测试失败:', error);
return { success: false, error: error.message };
}
};
export default testConfigService;