- 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,
|
auditHandler *auditinterfaces.Handler,
|
||||||
settingsHandler *settingsinterfaces.Handler,
|
settingsHandler *settingsinterfaces.Handler,
|
||||||
notificationHandler *notificationinterfaces.Handler,
|
notificationHandler *notificationinterfaces.Handler,
|
||||||
|
examplePlugin *exampleinterfaces.ExamplePlugin,
|
||||||
) *gin.Engine {
|
) *gin.Engine {
|
||||||
ginMode := "release"
|
ginMode := "release"
|
||||||
if cfg.Server.Mode == "debug" || cfg.Server.Mode == "dev" {
|
if cfg.Server.Mode == "debug" || cfg.Server.Mode == "dev" {
|
||||||
@ -77,9 +78,7 @@ func newEngine(
|
|||||||
settingsinterfaces.SetupRoutes(r, settingsHandler, authMW)
|
settingsinterfaces.SetupRoutes(r, settingsHandler, authMW)
|
||||||
notificationinterfaces.SetupRoutes(r, notificationHandler, authMW)
|
notificationinterfaces.SetupRoutes(r, notificationHandler, authMW)
|
||||||
|
|
||||||
for _, p := range plugin.All() {
|
examplePlugin.SetupRoutes(r, authMW)
|
||||||
p.SetupRoutes(r, authMW)
|
|
||||||
}
|
|
||||||
|
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user