feat: 新增访客拦截器
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user