使用qoder优化后更新
Some checks failed
Go build / build and run (push) Has been cancelled

This commit is contained in:
2026-02-12 13:48:35 +08:00
parent abd5962ae9
commit bc59f616fd
15 changed files with 130 additions and 278 deletions

View File

@@ -49,15 +49,15 @@ func main() {
}
// 5. 创建Gin实例
// 根据环境设置Gin模式
if conf.Env == config.EnvProduction {
gin.SetMode(gin.ReleaseMode)
}
router := gin.Default()
router := gin.New()
router.Use(gin.Recovery())
themeManager.RegisterStaticRoutes(router)
// 初始化Session存储使用Cookie
store := cookie.NewStore([]byte("your-session-secret")) // 建议从配置文件读取密钥
store := cookie.NewStore([]byte("your-session-secret"))
store.Options(sessions.Options{
Path: "/",
MaxAge: 86400 * 7, // 7天
@@ -66,8 +66,6 @@ func main() {
// 6. 注册中间件
router.Use(
loggerMiddleware(),
gin.Logger(),
gin.Recovery(),
databaseMiddleware(models.DB),
configMiddleware(conf),
themeMiddleware(themeManager),