From 70a5e3ffaf73bbbad2f373a256fa6b97f88e0f29 Mon Sep 17 00:00:00 2001 From: MengStack Dev Date: Sat, 3 Oct 2026 02:10:45 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=8F=92=E4=BB=B6=E8=B7=AF=E7=94=B1?= =?UTF-8?q?=E6=B3=A8=E5=86=8C=20=E2=80=94=20=E9=80=9A=E8=BF=87=20fx=20?= =?UTF-8?q?=E4=BE=9D=E8=B5=96=E6=B3=A8=E5=85=A5=E7=A1=AE=E4=BF=9D=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E6=9E=84=E9=80=A0=E5=B9=B6=E6=B3=A8=E5=86=8C=E8=B7=AF?= =?UTF-8?q?=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - newEngine 接收 *ExamplePlugin 强制 fx 构造插件实例 - 直接调用 examplePlugin.SetupRoutes 注册路由 - 移除 plugin.All() 循环(避免双重注册) --- internal/app/app.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/internal/app/app.go b/internal/app/app.go index bd8fc74..ae93188 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -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 }