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>
|
</style>
|
||||||
<script src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/markdown-it/12.3.2/markdown-it.min.js"></script>
|
<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>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@ -132,33 +133,40 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
let detailHtml = `
|
let detailHtml = `
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>接口</th>
|
<th>接口</th>
|
||||||
<th>今日调用</th>
|
<th>今日调用</th>
|
||||||
<th>总调用</th>
|
<th>总调用</th>
|
||||||
<th>查看</th>
|
<th>URL数量</th>
|
||||||
</tr>
|
<th>查看</th>
|
||||||
</thead>
|
</tr>
|
||||||
<tbody>
|
</thead>
|
||||||
`;
|
<tbody>
|
||||||
|
`;
|
||||||
|
|
||||||
|
// 同时加载URL统计数据
|
||||||
|
const urlStatsResponse = await fetch('/urlstats');
|
||||||
|
const urlStats = await urlStatsResponse.json();
|
||||||
|
|
||||||
sortedEndpoints.forEach(([endpoint, stat]) => {
|
sortedEndpoints.forEach(([endpoint, stat]) => {
|
||||||
|
const urlCount = urlStats[endpoint]?.total_urls || 0;
|
||||||
detailHtml += `
|
detailHtml += `
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a href="javascript:void(0)"
|
<a href="javascript:void(0)"
|
||||||
onclick="copyToClipboard('${endpoint}')"
|
onclick="copyToClipboard('${endpoint}')"
|
||||||
class="endpoint-link"
|
class="endpoint-link"
|
||||||
title="点击复制链接">
|
title="点击复制链接">
|
||||||
${getDisplayName(endpoint, endpointConfig)}
|
${getDisplayName(endpoint, endpointConfig)}
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>${stat.today_calls}</td>
|
<td>${stat.today_calls}</td>
|
||||||
<td>${stat.total_calls}</td>
|
<td>${stat.total_calls}</td>
|
||||||
<td><a href="${endpoint}" target="_blank" rel="noopener noreferrer">👀</a></td>
|
<td>${urlCount}</td>
|
||||||
</tr>
|
<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) {
|
func GetCSVContent(path string) (*models.URLSelector, error) {
|
||||||
log.Printf("开始获取CSV内容: %s", path)
|
// log.Printf("开始获取CSV内容: %s", path)
|
||||||
|
|
||||||
Mu.RLock()
|
Mu.RLock()
|
||||||
selector, exists := csvCache[path]
|
selector, exists := csvCache[path]
|
||||||
Mu.RUnlock()
|
Mu.RUnlock()
|
||||||
|
|
||||||
if exists {
|
if exists {
|
||||||
log.Printf("从缓存中获取到CSV内容: %s", path)
|
// log.Printf("从缓存中获取到CSV内容: %s", path)
|
||||||
return selector, nil
|
return selector, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user