feat: 增加地理位置定位功能
This commit is contained in:
parent
50bc67c5d8
commit
f4490c3395
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BootstrapBlazor" Version="6.2.9-beta05" />
|
||||
<PackageReference Include="BootstrapBlazor" Version="6.2.9-beta06" />
|
||||
<PackageReference Include="Longbow.Security.Cryptography" Version="5.2.0" />
|
||||
<PackageReference Include="Microsoft.Data.Sqlite" Version="6.0.1" />
|
||||
<PackageReference Include="PetaPoco.Extensions" Version="6.0.0" />
|
||||
|
|
|
@ -36,6 +36,9 @@ namespace Microsoft.Extensions.DependencyInjection
|
|||
// 增加 BootstrapBlazor 组件
|
||||
services.AddBootstrapBlazor();
|
||||
|
||||
// 配置地理位置定位器
|
||||
services.ConfigureIPLocatorOption(op => op.LocatorFactory = LocatorHelper.CreateLocator);
|
||||
|
||||
// 增加手机短信服务
|
||||
services.AddSingleton<ISMSProvider, TencentSMSProvider>();
|
||||
|
||||
|
|
|
@ -174,5 +174,11 @@ public partial class Settings
|
|||
await ShowToast(ret, "日志缓存");
|
||||
}
|
||||
|
||||
private Task RenderLayout(string key) => Layout.OnUpdate(key);
|
||||
private async Task RenderLayout(string key)
|
||||
{
|
||||
if (Layout.OnUpdate != null)
|
||||
{
|
||||
await Layout.OnUpdate(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ namespace BootstrapAdmin.Web.Shared
|
|||
var city = "XX XX";
|
||||
if (!string.IsNullOrEmpty(clientInfo.Ip))
|
||||
{
|
||||
city = await IPLocatorProvider.Locate(clientInfo.Ip);
|
||||
city = await IPLocatorProvider.Locate(clientInfo.Ip) ?? "None";
|
||||
}
|
||||
TraceService.Log(new Trace
|
||||
{
|
||||
|
|
|
@ -10,7 +10,6 @@ static class LocatorHelper
|
|||
var providerName = dictService.GetIpLocatorName();
|
||||
var providerUrl = dictService.GetIpLocatorUrl(providerName ?? string.Empty);
|
||||
|
||||
// TODO: 稍后完善 其余地理位置定位服务
|
||||
return providerName switch
|
||||
{
|
||||
"BaiDuIPSvr" => new BaiDuIPLocator(),
|
||||
|
|
Loading…
Reference in New Issue