优化日志查询页面

This commit is contained in:
Alex Yang
2025-11-30 03:24:20 +08:00
parent fb9a62f2a7
commit 9fffac0fb7
5 changed files with 16675 additions and 37 deletions

View File

@@ -1245,6 +1245,8 @@ func (s *Server) handleLogsQuery(w http.ResponseWriter, r *http.Request) {
// 获取查询参数
limit := 100 // 默认返回100条日志
offset := 0
sortField := r.URL.Query().Get("sort")
sortDirection := r.URL.Query().Get("direction")
if limitStr := r.URL.Query().Get("limit"); limitStr != "" {
fmt.Sscanf(limitStr, "%d", &limit)
@@ -1255,7 +1257,7 @@ func (s *Server) handleLogsQuery(w http.ResponseWriter, r *http.Request) {
}
// 获取日志数据
logs := s.dnsServer.GetQueryLogs(limit, offset)
logs := s.dnsServer.GetQueryLogs(limit, offset, sortField, sortDirection)
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(logs)