package service import ( "context" "github.com/gogf/gf/v2/net/ghttp" ) type ( IMiddleware interface { ResponseHandler(r *ghttp.Request) ApiCtx(r *ghttp.Request) ApiAuth(r *ghttp.Request) OldResponseHandler(r *ghttp.Request) OldCtx(r *ghttp.Request) OldAuth(r *ghttp.Request) IsExceptLogin(ctx context.Context, path string) bool } ) var ( localMiddleware IMiddleware ) func Middleware() IMiddleware { if localMiddleware == nil { panic("implement not found for interface IMiddleware, forgot register?") } return localMiddleware } func RegisterMiddleware(i IMiddleware) { localMiddleware = i }