chore: 并入 iotlcm-openapi 历史到 openapi/(原提交 3b05d5a)
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user