This commit is contained in:
孟帅
2023-04-05 12:29:33 +08:00
parent c709073ed7
commit 075a12ce7e
27 changed files with 703 additions and 168 deletions

View File

@@ -18,10 +18,7 @@ import (
// ApiAuth API鉴权中间件
func (s *sMiddleware) ApiAuth(r *ghttp.Request) {
var (
ctx = r.Context()
)
var ctx = r.Context()
// 替换掉模块前缀
routerPrefix := g.Cfg().MustGet(ctx, "router.api.prefix", "/api")

View File

@@ -97,9 +97,7 @@ func (s *sMiddleware) DemoLimit(r *ghttp.Request) {
// Addon 插件中间件
func (s *sMiddleware) Addon(r *ghttp.Request) {
var (
ctx = r.Context()
)
var ctx = r.Context()
if contexts.Get(ctx).Module == "" {
g.Log().Warning(ctx, "application module is not initialized.")

View File

@@ -16,7 +16,7 @@ func (s *sMiddleware) Blacklist(r *ghttp.Request) {
response.JsonExit(r, gcode.CodeServerBusy.Code(), "请求异常,已被封禁,如有疑问请联系管理员!")
}
} else {
g.Log().Warningf(r.Context(), "blacklists uninitialized")
g.Log().Infof(r.Context(), "blacklists uninitialized")
}
r.Middleware.Next()

View File

@@ -18,10 +18,7 @@ import (
// WebSocketToken 检查ws连接token
func (s *sMiddleware) WebSocketToken(r *ghttp.Request) {
var (
ctx = r.Context()
)
var ctx = r.Context()
// 替换掉模块前缀
routerPrefix := g.Cfg().MustGet(ctx, "router.ws.prefix", "/socket")