mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-08-28 05:12:32 +08:00
插件增加静态文件目录自动映射,优化插件模板引擎与主模块的耦合关系
This commit is contained in:
@@ -133,7 +133,23 @@ func (s *sMiddleware) Addon(r *ghttp.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
contexts.SetAddonName(ctx, addons.GetModule(ss[0]).GetSkeleton().Name)
|
||||
module := addons.GetModule(ss[0])
|
||||
if module == nil {
|
||||
g.Log().Warningf(ctx, "addon module = nil, name:%v", ss[0])
|
||||
return
|
||||
}
|
||||
|
||||
sk := module.GetSkeleton()
|
||||
if sk == nil {
|
||||
g.Log().Warningf(ctx, "addon skeleton = nil, name:%v", ss[0])
|
||||
return
|
||||
}
|
||||
|
||||
if sk.View != nil {
|
||||
r.SetView(sk.View)
|
||||
}
|
||||
|
||||
contexts.SetAddonName(ctx, sk.Name)
|
||||
r.Middleware.Next()
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user