调整日志和鉴权接管方案

This commit is contained in:
2026-04-04 20:50:45 +08:00
parent 15f72873db
commit 76f0d815aa
20 changed files with 944 additions and 402 deletions

View File

@@ -41,12 +41,12 @@ func RegisterAdminRoutes(rg *gin.RouterGroup) {
authorized.POST("/settings/generate-key", adminctl.SettingsGenerateKeyHandler)
// 操作日志API
authorized.GET("/logs", adminctl.LogsListHandler)
authorized.POST("/logs/clear", adminctl.LogsClearHandler)
authorized.GET("/logs", adminctl.LogsListHandler) // 获取操作日志列表
authorized.POST("/logs/clear", adminctl.LogsClearHandler) // 清空操作日志
// 登录日志API
authorized.GET("/login_logs", adminctl.LoginLogsListHandler)
authorized.POST("/login_logs/clear", adminctl.LoginLogsClearHandler)
authorized.GET("/login_logs", adminctl.LoginLogsListHandler) // 获取登录日志列表
authorized.POST("/login_logs/clear", adminctl.LoginLogsClearHandler) // 清空登录日志
// 子账号相关API (Mock)
authorized.GET("/subaccounts/simple", adminctl.SubAccountSimpleListHandler)

View File

@@ -2,6 +2,8 @@ package server
import (
defaultctrl "NetworkAuth/controllers/default"
"NetworkAuth/middleware"
"time"
"github.com/gin-gonic/gin"
)
@@ -11,6 +13,6 @@ import (
func RegisterDefaultRoutes(rg *gin.RouterGroup) {
homeGroup := rg.Group("/home")
// 根路径
homeGroup.GET("", defaultctrl.RootHandler)
// 根路径 (限制:每分钟最多 60 次请求,防止 CC)
homeGroup.GET("", middleware.RateLimit(60, time.Minute), defaultctrl.RootHandler)
}