- newEngine 接收 *ExamplePlugin 强制 fx 构造插件实例 - 直接调用 examplePlugin.SetupRoutes 注册路由 - 移除 plugin.All() 循环(避免双重注册)
This commit is contained in:
parent
7ad62c7488
commit
70a5e3ffaf
@ -49,6 +49,7 @@ func newEngine(
|
||||
auditHandler *auditinterfaces.Handler,
|
||||
settingsHandler *settingsinterfaces.Handler,
|
||||
notificationHandler *notificationinterfaces.Handler,
|
||||
examplePlugin *exampleinterfaces.ExamplePlugin,
|
||||
) *gin.Engine {
|
||||
ginMode := "release"
|
||||
if cfg.Server.Mode == "debug" || cfg.Server.Mode == "dev" {
|
||||
@ -77,9 +78,7 @@ func newEngine(
|
||||
settingsinterfaces.SetupRoutes(r, settingsHandler, authMW)
|
||||
notificationinterfaces.SetupRoutes(r, notificationHandler, authMW)
|
||||
|
||||
for _, p := range plugin.All() {
|
||||
p.SetupRoutes(r, authMW)
|
||||
}
|
||||
examplePlugin.SetupRoutes(r, authMW)
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user