Files
SmsReceiver-go/templates/statistics.html
OpenClaw Agent 4a31cd1115 initial commit: Go version of SMS Receiver with fixed template rendering
- Implemented all core features from Python version
- Fixed int64/int type compatibility in template functions
- Added login authentication, SMS receiving, statistics, logs
- Independent database: sms_receiver_go.db
- Fixed frontend display issues for message list and statistics
2026-02-08 17:15:22 +08:00

284 lines
8.1 KiB
HTML

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>统计信息 - 短信转发接收端</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
padding: 20px;
}
.container {
max-width: 1200px;
margin: 0 auto;
}
.header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
background: white;
padding: 20px;
border-radius: 10px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
animation: slideInDown 0.5s ease-out;
}
.header h1 {
font-size: 24px;
color: #333;
}
.nav {
display: flex;
gap: 10px;
flex-wrap: wrap;
}
.nav a {
padding: 8px 16px;
text-decoration: none;
background: #667eea;
color: white;
border-radius: 5px;
transition: background 0.3s;
}
.nav a:hover {
background: #764ba2;
}
.nav a.active {
background: #764ba2;
}
.nav .logout {
background: #dc3545;
}
.nav .logout:hover {
background: #c82333;
}
.stats {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 20px;
margin-bottom: 30px;
animation: fadeInUp 0.5s ease-out forwards;
opacity: 0;
}
.stats .stat-card:nth-child(1) { animation-delay: 0.1s; }
.stats .stat-card:nth-child(2) { animation-delay: 0.2s; }
.stats .stat-card:nth-child(3) { animation-delay: 0.3s; }
.stats .stat-card:nth-child(4) { animation-delay: 0.4s; }
.stat-card {
background: white;
padding: 30px 20px;
border-radius: 10px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
text-align: center;
}
.stat-card h3 {
font-size: 14px;
color: #666;
margin-bottom: 15px;
}
.stat-card .value {
font-size: 36px;
font-weight: bold;
color: #333;
}
.stat-card.blue { border-top: 4px solid #667eea; }
.stat-card.green { border-top: 4px solid #38ef7d; }
.stat-card.orange { border-top: 4px solid #f5576c; }
.stat-card.purple { border-top: 4px solid #764ba2; }
.detail-section {
background: white;
border-radius: 10px;
padding: 25px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
animation: fadeInUp 0.5s ease-out forwards;
opacity: 0;
animation-delay: 0.5s;
}
.detail-section h2 {
font-size: 18px;
color: #333;
margin-bottom: 20px;
padding-bottom: 10px;
border-bottom: 1px solid #eee;
}
.detail-section table {
width: 100%;
border-collapse: collapse;
}
.detail-section td {
padding: 15px;
border-bottom: 1px solid #eee;
}
.detail-section td:first-child {
color: #666;
width: 150px;
}
.detail-section tr:hover {
background-color: #f9f9f9;
}
.badge {
display: inline-block;
padding: 4px 12px;
border-radius: 10px;
font-size: 14px;
font-weight: bold;
}
.badge-success {
background: #d4edda;
color: #155724;
}
.badge-warning {
background: #fff3cd;
color: #856404;
}
.badge-danger {
background: #f8d7da;
color: #721c24;
}
.progress-bar {
width: 100%;
height: 20px;
background: #f0f0f0;
border-radius: 10px;
overflow: hidden;
margin-top: 10px;
}
.progress-bar .fill {
height: 100%;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
transition: width 0.5s ease;
}
@keyframes fadeInUp {
from { opacity: 0; transform: translateY(20px); }
to { opacity: 1; transform: translateY(0); }
}
@keyframes slideInDown {
from { opacity: 0; transform: translateY(-30px); }
to { opacity: 1; transform: translateY(0); }
}
@media (max-width: 768px) {
.header { flex-direction: column; gap: 15px; }
.nav { justify-content: center; }
.stats { grid-template-columns: 1fr 1fr; }
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>📊 统计信息</h1>
<div class="nav">
<a href="/">短信列表</a>
<a href="/logs">接收日志</a>
<a href="/statistics" class="active">统计信息</a>
<a href="/logout" class="logout">退出登录</a>
</div>
</div>
<div class="stats">
<div class="stat-card blue">
<h3>短信总数</h3>
<div class="value">{{.stats.Total}}</div>
</div>
<div class="stat-card green">
<h3>今日短信</h3>
<div class="value">{{.stats.Today}}</div>
</div>
<div class="stat-card orange">
<h3>本周短信</h3>
<div class="value">{{.stats.Week}}</div>
</div>
<div class="stat-card purple">
<h3>签名验证</h3>
<div class="value">{{add .stats.Verified .stats.Unverified}}</div>
</div>
</div>
<div class="detail-section">
<h2>签名验证详情</h2>
<table>
<tr>
<td>已验证签名</td>
<td>
<span class="badge badge-success">{{.stats.Verified}} 条</span>
</td>
</tr>
<tr>
<td>未验证签名</td>
<td>
{{if .stats.Unverified}}
<span class="badge badge-warning">{{.stats.Unverified}} 条</span>
{{else}}
<span class="badge badge-success">0 条</span>
{{end}}
</td>
</tr>
<tr>
<td>验证通过率</td>
<td>
{{if .stats.Total}}
{{if .stats.Verified}}
<span class="badge badge-success">{{printf "%.1f" (mulFloat .stats.Verified .stats.Total)}}%</span>
{{else}}
<span class="badge badge-warning">0%</span>
{{end}}
{{else}}
<span style="color: #999;">N/A</span>
{{end}}
</td>
</tr>
</table>
{{if .stats.Total}}
{{$verified := .stats.Verified}}
{{$total := .stats.Total}}
<div class="progress-bar">
<div class="fill" style="width: {{mulFloat $verified $total}}%"></div>
</div>
<p style="margin-top: 10px; color: #666; font-size: 14px;">
已验证 {{.stats.Verified}} / 总数 {{.stats.Total}}
</p>
{{end}}
</div>
</div>
</body>
</html>