feat: 新增访客拦截器

This commit is contained in:
2026-03-03 00:58:22 +08:00
parent 52cfe1b911
commit 00a0a01b17
7 changed files with 566 additions and 0 deletions

View File

@@ -116,6 +116,12 @@ func getUserFields(ctx context.Context) []zap.Field {
if fromIP := web.GetFromIP(ctx); fromIP != "" {
fields = append(fields, zap.String("from_ip", fromIP))
}
if province := web.GetProvince(ctx); province != "" {
fields = append(fields, zap.String("province", province))
}
if city := web.GetCity(ctx); city != "" {
fields = append(fields, zap.String("city", city))
}
if len(fields) == 0 {
return nil