mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-22 16:43:35 +00:00
refactor: standardize code formatting and linting configuration
- Replace .eslintrc.js with .eslintrc.cjs for better ES module compatibility - Add .prettierrc configuration for consistent code formatting - Update package.json with new lint and format scripts - Add nodemon.json for development hot reloading configuration - Standardize code formatting across all JavaScript and Vue files - Update web admin SPA with improved linting rules and formatting - Add prettier configuration to web admin SPA 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -2,131 +2,132 @@
|
||||
* 测试专属账号显示问题
|
||||
*/
|
||||
|
||||
const redis = require('../src/models/redis');
|
||||
const redis = require('../src/models/redis')
|
||||
|
||||
async function testDedicatedAccounts() {
|
||||
console.log('🔍 检查专属账号...\n');
|
||||
console.log('🔍 检查专属账号...\n')
|
||||
|
||||
try {
|
||||
// 确保 Redis 已连接
|
||||
await redis.connect();
|
||||
|
||||
await redis.connect()
|
||||
|
||||
// 获取所有 Claude 账号
|
||||
const claudeKeys = await redis.client.keys('claude:account:*');
|
||||
console.log(`找到 ${claudeKeys.length} 个 Claude 账号\n`);
|
||||
|
||||
const dedicatedAccounts = [];
|
||||
const groupAccounts = [];
|
||||
const sharedAccounts = [];
|
||||
|
||||
const claudeKeys = await redis.client.keys('claude:account:*')
|
||||
console.log(`找到 ${claudeKeys.length} 个 Claude 账号\n`)
|
||||
|
||||
const dedicatedAccounts = []
|
||||
const groupAccounts = []
|
||||
const sharedAccounts = []
|
||||
|
||||
for (const key of claudeKeys) {
|
||||
const account = await redis.client.hgetall(key);
|
||||
const accountType = account.accountType || 'shared';
|
||||
|
||||
const account = await redis.client.hgetall(key)
|
||||
const accountType = account.accountType || 'shared'
|
||||
|
||||
const accountInfo = {
|
||||
id: account.id,
|
||||
name: account.name,
|
||||
accountType: accountType,
|
||||
accountType,
|
||||
status: account.status,
|
||||
isActive: account.isActive,
|
||||
createdAt: account.createdAt
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
if (accountType === 'dedicated') {
|
||||
dedicatedAccounts.push(accountInfo);
|
||||
dedicatedAccounts.push(accountInfo)
|
||||
} else if (accountType === 'group') {
|
||||
groupAccounts.push(accountInfo);
|
||||
groupAccounts.push(accountInfo)
|
||||
} else {
|
||||
sharedAccounts.push(accountInfo);
|
||||
sharedAccounts.push(accountInfo)
|
||||
}
|
||||
}
|
||||
|
||||
console.log('📊 账号统计:');
|
||||
console.log(`- 专属账号: ${dedicatedAccounts.length} 个`);
|
||||
console.log(`- 分组账号: ${groupAccounts.length} 个`);
|
||||
console.log(`- 共享账号: ${sharedAccounts.length} 个`);
|
||||
console.log('');
|
||||
|
||||
|
||||
console.log('📊 账号统计:')
|
||||
console.log(`- 专属账号: ${dedicatedAccounts.length} 个`)
|
||||
console.log(`- 分组账号: ${groupAccounts.length} 个`)
|
||||
console.log(`- 共享账号: ${sharedAccounts.length} 个`)
|
||||
console.log('')
|
||||
|
||||
if (dedicatedAccounts.length > 0) {
|
||||
console.log('✅ 专属账号列表:');
|
||||
dedicatedAccounts.forEach(acc => {
|
||||
console.log(` - ${acc.name} (ID: ${acc.id}, 状态: ${acc.status})`);
|
||||
});
|
||||
console.log('');
|
||||
console.log('✅ 专属账号列表:')
|
||||
dedicatedAccounts.forEach((acc) => {
|
||||
console.log(` - ${acc.name} (ID: ${acc.id}, 状态: ${acc.status})`)
|
||||
})
|
||||
console.log('')
|
||||
} else {
|
||||
console.log('⚠️ 没有找到专属账号!');
|
||||
console.log('💡 提示: 请确保在账号管理页面将账号类型设置为"专属账户"');
|
||||
console.log('');
|
||||
console.log('⚠️ 没有找到专属账号!')
|
||||
console.log('💡 提示: 请确保在账号管理页面将账号类型设置为"专属账户"')
|
||||
console.log('')
|
||||
}
|
||||
|
||||
|
||||
if (groupAccounts.length > 0) {
|
||||
console.log('📁 分组账号列表:');
|
||||
groupAccounts.forEach(acc => {
|
||||
console.log(` - ${acc.name} (ID: ${acc.id}, 状态: ${acc.status})`);
|
||||
});
|
||||
console.log('');
|
||||
console.log('📁 分组账号列表:')
|
||||
groupAccounts.forEach((acc) => {
|
||||
console.log(` - ${acc.name} (ID: ${acc.id}, 状态: ${acc.status})`)
|
||||
})
|
||||
console.log('')
|
||||
}
|
||||
|
||||
|
||||
// 检查分组
|
||||
const groupKeys = await redis.client.keys('account_group:*');
|
||||
console.log(`\n找到 ${groupKeys.length} 个账号分组`);
|
||||
|
||||
const groupKeys = await redis.client.keys('account_group:*')
|
||||
console.log(`\n找到 ${groupKeys.length} 个账号分组`)
|
||||
|
||||
if (groupKeys.length > 0) {
|
||||
console.log('📋 分组列表:');
|
||||
console.log('📋 分组列表:')
|
||||
for (const key of groupKeys) {
|
||||
const group = await redis.client.hgetall(key);
|
||||
console.log(` - ${group.name} (平台: ${group.platform}, 成员数: ${group.memberCount || 0})`);
|
||||
const group = await redis.client.hgetall(key)
|
||||
console.log(
|
||||
` - ${group.name} (平台: ${group.platform}, 成员数: ${group.memberCount || 0})`
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 检查 Claude Console 账号
|
||||
const consoleKeys = await redis.client.keys('claude_console_account:*');
|
||||
console.log(`\n找到 ${consoleKeys.length} 个 Claude Console 账号`);
|
||||
|
||||
const dedicatedConsoleAccounts = [];
|
||||
const groupConsoleAccounts = [];
|
||||
|
||||
const consoleKeys = await redis.client.keys('claude_console_account:*')
|
||||
console.log(`\n找到 ${consoleKeys.length} 个 Claude Console 账号`)
|
||||
|
||||
const dedicatedConsoleAccounts = []
|
||||
const groupConsoleAccounts = []
|
||||
|
||||
for (const key of consoleKeys) {
|
||||
const account = await redis.client.hgetall(key);
|
||||
const accountType = account.accountType || 'shared';
|
||||
|
||||
const account = await redis.client.hgetall(key)
|
||||
const accountType = account.accountType || 'shared'
|
||||
|
||||
if (accountType === 'dedicated') {
|
||||
dedicatedConsoleAccounts.push({
|
||||
id: account.id,
|
||||
name: account.name,
|
||||
accountType: accountType,
|
||||
accountType,
|
||||
status: account.status
|
||||
});
|
||||
})
|
||||
} else if (accountType === 'group') {
|
||||
groupConsoleAccounts.push({
|
||||
id: account.id,
|
||||
name: account.name,
|
||||
accountType: accountType,
|
||||
accountType,
|
||||
status: account.status
|
||||
});
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (dedicatedConsoleAccounts.length > 0) {
|
||||
console.log('\n✅ Claude Console 专属账号:');
|
||||
dedicatedConsoleAccounts.forEach(acc => {
|
||||
console.log(` - ${acc.name} (ID: ${acc.id}, 状态: ${acc.status})`);
|
||||
});
|
||||
console.log('\n✅ Claude Console 专属账号:')
|
||||
dedicatedConsoleAccounts.forEach((acc) => {
|
||||
console.log(` - ${acc.name} (ID: ${acc.id}, 状态: ${acc.status})`)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
if (groupConsoleAccounts.length > 0) {
|
||||
console.log('\n📁 Claude Console 分组账号:');
|
||||
groupConsoleAccounts.forEach(acc => {
|
||||
console.log(` - ${acc.name} (ID: ${acc.id}, 状态: ${acc.status})`);
|
||||
});
|
||||
console.log('\n📁 Claude Console 分组账号:')
|
||||
groupConsoleAccounts.forEach((acc) => {
|
||||
console.log(` - ${acc.name} (ID: ${acc.id}, 状态: ${acc.status})`)
|
||||
})
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('❌ 错误:', error);
|
||||
console.error(error.stack);
|
||||
console.error('❌ 错误:', error)
|
||||
console.error(error.stack)
|
||||
} finally {
|
||||
process.exit(0);
|
||||
process.exit(0)
|
||||
}
|
||||
}
|
||||
|
||||
testDedicatedAccounts();
|
||||
testDedicatedAccounts()
|
||||
|
||||
Reference in New Issue
Block a user