feat: Add batch processing and upload functionality, including new backend APIs, logging system, SQLite database, and dedicated frontend pages.

This commit is contained in:
2026-02-01 02:53:37 +08:00
parent 94ba61528a
commit a605e46f2a
9 changed files with 953 additions and 99 deletions

View File

@@ -203,6 +203,39 @@ func GetLogs(limit int) []LogEntry {
return result
}
// GetLogsByModule 按模块筛选日志并分页(最新的在前)
func GetLogsByModule(module string, page, pageSize int) ([]LogEntry, int) {
logsMu.RLock()
defer logsMu.RUnlock()
// 倒序收集匹配的日志
var filtered []LogEntry
for i := len(logs) - 1; i >= 0; i-- {
if logs[i].Module == module {
filtered = append(filtered, logs[i])
}
}
total := len(filtered)
if page < 1 {
page = 1
}
if pageSize <= 0 {
pageSize = 5
}
start := (page - 1) * pageSize
if start >= total {
return []LogEntry{}, total
}
end := start + pageSize
if end > total {
end = total
}
return filtered[start:end], total
}
// ClearLogs 清空日志
func ClearLogs() {
logsMu.Lock()