egg-api / index.html
luoyutianyang's picture
Update index.html
3b36a2a verified
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Face Replacement</title>
<style>
body {
background-image: url('/beijing.png');
background-size: cover;
background-repeat: no-repeat;
background-position: center;
height: 100vh;
margin: 0;
}
</style>
</head>
<body>
<h1>Face Replacement</h1>
<h2>API 请求统计</h2>
<table id="api-stats">
<thead>
<tr>
<th>API 名称</th>
<th>今日请求次数</th>
</tr>
</thead>
<tbody>
<!-- 动态填充数据 -->
</tbody>
</table>
<script>
async function fetchApiStats() {
const response = await fetch('/api-stats');
const stats = await response.json();
const tbody = document.querySelector('#api-stats tbody');
tbody.innerHTML = '';
for (const [apiName, count] of Object.entries(stats)) {
const row = document.createElement('tr');
row.innerHTML = `<td>${apiName}</td><td>${count}</td>`;
tbody.appendChild(row);
}
}
fetchApiStats();
setInterval(fetchApiStats, 60000); // 每分钟刷新一次
</script>
</body>
</html>