feat: enhance logging and message encryption features

- Introduced new logging services: operation logs, login logs, and data change logs.
- Added support for message content encryption in the Message model, including methods for encrypting and decrypting message segments.
- Updated router to include admin log handling and integrated log service for access logging.
- Modified configuration to support encryption settings.
This commit is contained in:
lafay
2026-03-15 20:38:22 +08:00
parent 700b8b6bad
commit b028f7e1d3
9 changed files with 500 additions and 31 deletions

View File

@@ -110,7 +110,6 @@ func (r *Router) setupRoutes() {
c.JSON(200, gin.H{"status": "ok"})
})
// API v1
v1 := r.engine.Group("/api/v1")
{
@@ -132,9 +131,9 @@ func (r *Router) setupRoutes() {
// === 访问日志中间件 ===
if r.adminLogHandler != nil && r.logService != nil {
accessLogConfig := &middleware.AccessLogConfig{
Enable: true,
SkipPaths: []string{"/health", "/api/v1/health"},
ServerIP: "0.0.0.0",
Enable: true,
SkipPaths: []string{"/health", "/api/v1/health"},
ServerIP: "0.0.0.0",
ServerPort: 8080,
}
r.engine.Use(middleware.AccessLogMiddleware(
@@ -142,11 +141,6 @@ func (r *Router) setupRoutes() {
accessLogConfig,
))
}
r.engine.Use(middleware.AccessLogMiddleware(
r.logService,
accessLogConfig,
))
}
// Casbin 权限中间件(暂不全局启用,可根据需要在特定路由组上使用)
// casbinMiddleware := middleware.CasbinAuth(r.casbinService)
@@ -478,6 +472,7 @@ func (r *Router) setupRoutes() {
}
}
}
}
// Engine 获取引擎
func (r *Router) Engine() *gin.Engine {