mirror of
https://github.com/woodchen-ink/random-api-go.git
synced 2025-07-18 13:52:02 +08:00
refactor(public, services): improve HTML structure and optimize CSV service logging
This commit is contained in:
parent
61e84d87b8
commit
a4d6890a78
@ -14,7 +14,8 @@
|
||||
|
||||
</style>
|
||||
<script src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/markdown-it/12.3.2/markdown-it.min.js"></script>
|
||||
<script defer src="https://analytics.czl.net/script.js" data-website-id="67f71dbc-799c-46b6-9c23-b1b012daef65"></script>
|
||||
<script defer src="https://analytics.czl.net/script.js"
|
||||
data-website-id="67f71dbc-799c-46b6-9c23-b1b012daef65"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@ -138,13 +139,19 @@
|
||||
<th>接口</th>
|
||||
<th>今日调用</th>
|
||||
<th>总调用</th>
|
||||
<th>URL数量</th>
|
||||
<th>查看</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
`;
|
||||
|
||||
// 同时加载URL统计数据
|
||||
const urlStatsResponse = await fetch('/urlstats');
|
||||
const urlStats = await urlStatsResponse.json();
|
||||
|
||||
sortedEndpoints.forEach(([endpoint, stat]) => {
|
||||
const urlCount = urlStats[endpoint]?.total_urls || 0;
|
||||
detailHtml += `
|
||||
<tr>
|
||||
<td>
|
||||
@ -157,6 +164,7 @@
|
||||
</td>
|
||||
<td>${stat.today_calls}</td>
|
||||
<td>${stat.total_calls}</td>
|
||||
<td>${urlCount}</td>
|
||||
<td><a href="${endpoint}" target="_blank" rel="noopener noreferrer">👀</a></td>
|
||||
</tr>
|
||||
`;
|
||||
|
@ -121,14 +121,14 @@ func LoadCSVPaths() error {
|
||||
}
|
||||
|
||||
func GetCSVContent(path string) (*models.URLSelector, error) {
|
||||
log.Printf("开始获取CSV内容: %s", path)
|
||||
// log.Printf("开始获取CSV内容: %s", path)
|
||||
|
||||
Mu.RLock()
|
||||
selector, exists := csvCache[path]
|
||||
Mu.RUnlock()
|
||||
|
||||
if exists {
|
||||
log.Printf("从缓存中获取到CSV内容: %s", path)
|
||||
// log.Printf("从缓存中获取到CSV内容: %s", path)
|
||||
return selector, nil
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user