File size: 1,432 Bytes
7892661
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3b36a2a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7892661
3b36a2a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<!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>