增加集群部署支持,修复定时任务分组添加后选项不显示

This commit is contained in:
孟帅
2023-07-26 16:49:09 +08:00
parent 996ed818ee
commit 12bf36cd15
22 changed files with 1185 additions and 529 deletions

View File

@@ -1,23 +1,16 @@
package middleware
import (
"github.com/gogf/gf/v2/errors/gcode"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/net/ghttp"
"hotgo/internal/global"
"hotgo/internal/library/location"
"hotgo/internal/library/response"
"hotgo/internal/service"
)
// Blacklist IP黑名单限制中间件
func (s *sMiddleware) Blacklist(r *ghttp.Request) {
if global.Blacklists != nil {
if _, ok := global.Blacklists[location.GetClientIp(r)]; ok {
response.JsonExit(r, gcode.CodeServerBusy.Code(), "请求异常,已被封禁,如有疑问请联系管理员!")
}
} else {
g.Log().Info(r.Context(), "blacklists uninitialized")
if err := service.SysBlacklist().VerifyRequest(r); err != nil {
response.JsonExit(r, gerror.Code(err).Code(), err.Error())
}
r.Middleware.Next()
}