优化工作-1

This commit is contained in:
yml2213
2026-06-05 07:41:52 +08:00
parent b7ec5e2755
commit 0b9b0b5ea7
17 changed files with 1807 additions and 127 deletions
+9
View File
@@ -27,7 +27,11 @@ import (
"hfb_sys/backend/internal/modules/user"
"hfb_sys/backend/internal/modules/wallet"
_ "hfb_sys/backend/docs" // Swagger 文档
"github.com/gin-gonic/gin"
swaggerFiles "github.com/swaggo/files"
ginSwagger "github.com/swaggo/gin-swagger"
"go.uber.org/zap"
)
@@ -44,6 +48,11 @@ func New(cfg config.Config, deps Dependencies, logger *zap.Logger) *gin.Engine {
health := handler.NewHealthHandler()
engine.GET("/health", health.Check)
// Swagger 文档路由(仅在非生产环境)
if cfg.AppEnv != "production" {
engine.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
}
jwtManager := auth.NewJWTManager(cfg.JWTSecret)
var userRepo *auth.UserRepository
if deps.DB != nil {