Browse Source
Merge pull request #1436 from colinin/ip-location
feat: Optimize IP address location
pull/1442/head
yx lin
3 weeks ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with
19 additions and
1 deletions
-
aspnet-core/services/LY.MicroService.Applications.Single/LY.MicroService.Applications.Single.csproj
-
aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.Configure.cs
-
aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.cs
|
|
@ -7,7 +7,7 @@ |
|
|
<ImplicitUsings>enable</ImplicitUsings> |
|
|
<ImplicitUsings>enable</ImplicitUsings> |
|
|
<RootNamespace>LY.MicroService.Applications.Single</RootNamespace> |
|
|
<RootNamespace>LY.MicroService.Applications.Single</RootNamespace> |
|
|
<ImplicitUsings>enable</ImplicitUsings> |
|
|
<ImplicitUsings>enable</ImplicitUsings> |
|
|
<Version>9.3.6.2</Version> |
|
|
<Version>10.0.2</Version> |
|
|
</PropertyGroup> |
|
|
</PropertyGroup> |
|
|
|
|
|
|
|
|
<ItemGroup> |
|
|
<ItemGroup> |
|
|
|
|
|
@ -482,6 +482,23 @@ public partial class MicroServiceApplicationsSingleModule |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void ConfigureIP2RegionIPLocation() |
|
|
|
|
|
{ |
|
|
|
|
|
Configure<AbpIP2RegionLocationResolveOptions>(options => |
|
|
|
|
|
{ |
|
|
|
|
|
// 仅中国IP不显示国家
|
|
|
|
|
|
options.UseCountry = (localtion) => |
|
|
|
|
|
{ |
|
|
|
|
|
return !string.Equals("中国", localtion.Country); |
|
|
|
|
|
}; |
|
|
|
|
|
// 仅中国IP显示省份
|
|
|
|
|
|
options.UseProvince = (localtion) => |
|
|
|
|
|
{ |
|
|
|
|
|
return string.Equals("中国", localtion.Country); |
|
|
|
|
|
}; |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private void ConfigureIdempotent() |
|
|
private void ConfigureIdempotent() |
|
|
{ |
|
|
{ |
|
|
Configure<AbpIdempotentOptions>(options => |
|
|
Configure<AbpIdempotentOptions>(options => |
|
|
|
|
|
@ -428,6 +428,7 @@ public partial class MicroServiceApplicationsSingleModule : AbpModule |
|
|
ConfigureBackgroundTasks(); |
|
|
ConfigureBackgroundTasks(); |
|
|
ConfigureExceptionHandling(); |
|
|
ConfigureExceptionHandling(); |
|
|
ConfigureVirtualFileSystem(); |
|
|
ConfigureVirtualFileSystem(); |
|
|
|
|
|
ConfigureIP2RegionIPLocation(); |
|
|
ConfigureEntityDataProtected(); |
|
|
ConfigureEntityDataProtected(); |
|
|
ConfigureUrls(configuration); |
|
|
ConfigureUrls(configuration); |
|
|
ConfigureAuditing(configuration); |
|
|
ConfigureAuditing(configuration); |
|
|
|