日志增加区域
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
7c257f261c
commit
090cdaf2e4
|
@ -23,6 +23,7 @@ namespace IRaCIS.Core.Application.Triggers
|
|||
|
||||
//国家|区域|省份|城市|ISP 缺省的地域信息默认是0
|
||||
//0|0|0|内网IP|内网IP
|
||||
// 中国|0|湖北省|武汉市|电信
|
||||
public async Task BeforeSave(ITriggerContext<UserLog> context, CancellationToken cancellationToken)
|
||||
{
|
||||
var userLog = context.Entity;
|
||||
|
@ -30,9 +31,10 @@ namespace IRaCIS.Core.Application.Triggers
|
|||
if (context.ChangeType == ChangeType.Added)
|
||||
{
|
||||
|
||||
var dd = _searcher.Search(userLog.IP);
|
||||
var ipinfo = _searcher.Search(userLog.IP);
|
||||
|
||||
_logger.LogWarning(dd);
|
||||
userLog.IPRegion = string.Join('|', ipinfo.Split('|').TakeLast(3));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,6 +47,8 @@ namespace IRaCIS.Core.Domain.Models
|
|||
[JsonIgnore]
|
||||
public User OptUser { get; set; }
|
||||
|
||||
public string IPRegion { get; set; }
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in New Issue