Some checks failed
Deploy / deploy (push) Has been cancelled
Full-stack web application for Telegram management - Frontend: Vue 3 + Vben Admin - Backend: NestJS - Features: User management, group broadcast, statistics 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
117 lines
4.1 KiB
HTML
117 lines
4.1 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Verify API Working</title>
|
|
<style>
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
padding: 20px;
|
|
}
|
|
.test-item {
|
|
margin: 10px 0;
|
|
padding: 10px;
|
|
border: 1px solid #ddd;
|
|
border-radius: 4px;
|
|
}
|
|
.success { background-color: #d4edda; }
|
|
.error { background-color: #f8d7da; }
|
|
button {
|
|
margin: 5px;
|
|
padding: 5px 10px;
|
|
}
|
|
pre {
|
|
white-space: pre-wrap;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1>API验证页面</h1>
|
|
<p>这个页面会自动测试所有API是否正常工作</p>
|
|
|
|
<div id="results"></div>
|
|
|
|
<script>
|
|
const results = document.getElementById('results');
|
|
let token = localStorage.getItem('token') || '';
|
|
|
|
async function testAPI(name, url, method = 'POST', data = {}) {
|
|
const div = document.createElement('div');
|
|
div.className = 'test-item';
|
|
|
|
try {
|
|
const response = await fetch(url, {
|
|
method: method,
|
|
headers: {
|
|
'Content-Type': 'application/x-www-form-urlencoded',
|
|
'token': token
|
|
},
|
|
body: new URLSearchParams(data).toString()
|
|
});
|
|
|
|
const result = await response.json();
|
|
|
|
if (result.success) {
|
|
div.className += ' success';
|
|
div.innerHTML = `<strong>${name}</strong>: ✅ 成功<br>
|
|
数据: ${JSON.stringify(result.data).substring(0, 100)}...`;
|
|
} else {
|
|
div.className += ' error';
|
|
div.innerHTML = `<strong>${name}</strong>: ❌ 失败<br>
|
|
错误: ${result.msg || result.message || 'Unknown error'}`;
|
|
}
|
|
} catch (error) {
|
|
div.className += ' error';
|
|
div.innerHTML = `<strong>${name}</strong>: ❌ 请求失败<br>
|
|
错误: ${error.message}`;
|
|
}
|
|
|
|
results.appendChild(div);
|
|
}
|
|
|
|
async function runTests() {
|
|
results.innerHTML = '<h2>开始测试...</h2>';
|
|
|
|
// 先登录
|
|
const loginResponse = await fetch('/login', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/x-www-form-urlencoded'
|
|
},
|
|
body: new URLSearchParams({
|
|
account: 'admin',
|
|
password: '111111'
|
|
}).toString()
|
|
});
|
|
|
|
const loginResult = await loginResponse.json();
|
|
if (loginResult.success) {
|
|
token = loginResult.data;
|
|
localStorage.setItem('token', token);
|
|
results.innerHTML += '<p>✅ 登录成功</p>';
|
|
} else {
|
|
results.innerHTML += '<p>❌ 登录失败</p>';
|
|
return;
|
|
}
|
|
|
|
// 测试各个API
|
|
await testAPI('群组任务列表', '/groupTask/list');
|
|
await testAPI('脚本任务列表', '/scriptTask/list');
|
|
await testAPI('拉人任务列表', '/pullMemberTask/list');
|
|
await testAPI('代理平台列表', '/proxyPlatform/list');
|
|
await testAPI('基础信息', '/base', 'GET');
|
|
await testAPI('管理员信息', '/admin/info');
|
|
await testAPI('群组列表', '/group/list');
|
|
await testAPI('账号列表', '/tgAccount/list');
|
|
await testAPI('消息列表', '/message/list');
|
|
await testAPI('群组集合列表', '/groupMuster/list');
|
|
await testAPI('消息集合列表', '/messageMuster/list');
|
|
await testAPI('私信任务列表', '/directMessageTask/list');
|
|
await testAPI('私信任务引擎状态', '/directMessageTask/engine/status');
|
|
}
|
|
|
|
// 自动运行测试
|
|
runTests();
|
|
</script>
|
|
</body>
|
|
</html> |