feat: apply user settings to effect

This commit is contained in:
engigu
2025-12-20 13:30:08 +08:00
parent 07d988cc7e
commit a4d73a6f89
17 changed files with 168 additions and 111 deletions
+3 -2
View File
@@ -6,6 +6,7 @@ import (
"baihu/internal/controllers"
"baihu/internal/middleware"
"baihu/internal/services"
"baihu/internal/static"
"github.com/gin-gonic/gin"
@@ -40,7 +41,7 @@ func cacheControl(value string) gin.HandlerFunc {
}
}
func Setup(c *Controllers) *gin.Engine {
func Setup(c *Controllers, settingsService *services.SettingsService) *gin.Engine {
gin.SetMode(gin.ReleaseMode)
router := gin.New()
router.Use(middleware.GinLogger(), middleware.GinRecovery())
@@ -94,7 +95,7 @@ func Setup(c *Controllers) *gin.Engine {
// 需要认证的路由
authorized := api.Group("")
authorized.Use(middleware.AuthRequired())
authorized.Use(middleware.AuthRequired(settingsService))
{
// 获取当前用户
authorized.GET("/auth/me", c.Auth.GetCurrentUser)