This commit is contained in:
孟帅
2024-04-22 23:08:40 +08:00
parent 82483bd7b9
commit e144b12580
445 changed files with 17457 additions and 6708 deletions

View File

@@ -10,14 +10,19 @@ import (
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/net/ghttp"
"github.com/gogf/gf/v2/os/gtime"
"github.com/gogf/gf/v2/text/gstr"
"hotgo/internal/library/contexts"
"hotgo/internal/service"
"hotgo/utility/simple"
"strings"
)
// 忽略的请求方式
var ignoredRequestMethods = []string{"HEAD", "PRI"}
// accessLog 访问日志
func (s *sHook) accessLog(r *ghttp.Request) {
if r.IsFileRequest() {
if s.isIgnoredRequest(r) {
return
}
@@ -37,3 +42,15 @@ func (s *sHook) accessLog(r *ghttp.Request) {
}
})
}
// isIgnoredRequest 是否忽略请求
func (s *sHook) isIgnoredRequest(r *ghttp.Request) bool {
if r.IsFileRequest() {
return true
}
if gstr.InArray(ignoredRequestMethods, strings.ToUpper(r.Method)) {
return true
}
return false
}