This commit is contained in:
June 2021-03-15 10:17:32 +08:00
parent f2b98d5ed4
commit 8c05252378
2 changed files with 6 additions and 3 deletions

View File

@ -44,7 +44,8 @@ var (
// The hookfuncs will run in beego.Run() // The hookfuncs will run in beego.Run()
// such as initiating session , starting middleware , building template, starting admin control and so on. // such as initiating session , starting middleware , building template, starting admin control and so on.
func AddAPPStartHook(hf ...hookfunc) { func AddAPPStartHook(hf ...hookfunc) {
for _, f := range hf { for i := 0; i < len(hf); i++ {
f := hf[i]
web.AddAPPStartHook(func() error { web.AddAPPStartHook(func() error {
return f() return f()
}) })

View File

@ -39,7 +39,8 @@ func NewNamespace(prefix string, params ...LinkNamespace) *Namespace {
func oldToNewLinkNs(params []LinkNamespace) []web.LinkNamespace { func oldToNewLinkNs(params []LinkNamespace) []web.LinkNamespace {
nps := make([]web.LinkNamespace, 0, len(params)) nps := make([]web.LinkNamespace, 0, len(params))
for _, p := range params { for i := 0; i < len(params); i++ {
p := params[i]
nps = append(nps, func(namespace *web.Namespace) { nps = append(nps, func(namespace *web.Namespace) {
p((*Namespace)(namespace)) p((*Namespace)(namespace))
}) })
@ -82,7 +83,8 @@ func (n *Namespace) Filter(action string, filter ...FilterFunc) *Namespace {
func oldToNewFilter(filter []FilterFunc) []web.FilterFunc { func oldToNewFilter(filter []FilterFunc) []web.FilterFunc {
nfs := make([]web.FilterFunc, 0, len(filter)) nfs := make([]web.FilterFunc, 0, len(filter))
for _, f := range filter { for i := 0; i < len(filter); i++ {
f := filter[i]
nfs = append(nfs, func(ctx *context.Context) { nfs = append(nfs, func(ctx *context.Context) {
f((*adtContext.Context)(ctx)) f((*adtContext.Context)(ctx))
}) })