committed by
GitHub
32 changed files with 568 additions and 40 deletions
@ -0,0 +1,20 @@ |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.Location.Baidu.Model |
|||
{ |
|||
public class AddressDetail |
|||
{ |
|||
[JsonProperty("city")] |
|||
[JsonPropertyName("city")] |
|||
public string City { get; set; } |
|||
|
|||
[JsonProperty("city_code")] |
|||
[JsonPropertyName("city_code")] |
|||
public int CityCode { get; set; } |
|||
|
|||
[JsonProperty("province")] |
|||
[JsonPropertyName("province")] |
|||
public string Province { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.Location.Baidu.Model |
|||
{ |
|||
public class Content |
|||
{ |
|||
public string Address { get; set; } |
|||
|
|||
[JsonProperty("address_detail")] |
|||
[JsonPropertyName("address_detail")] |
|||
public AddressDetail AddressDetail { get; set; } = new AddressDetail(); |
|||
|
|||
public IpPoint Point { get; set; } = new IpPoint(); |
|||
} |
|||
} |
|||
@ -0,0 +1,29 @@ |
|||
using System; |
|||
|
|||
namespace LINGYUN.Abp.Location.Baidu.Model |
|||
{ |
|||
public class IpPoint |
|||
{ |
|||
public string X { get; set; } |
|||
public string Y { get; set; } |
|||
|
|||
public Point ToPoint() |
|||
{ |
|||
if (!X.IsNullOrWhiteSpace() && |
|||
!Y.IsNullOrWhiteSpace()) |
|||
{ |
|||
if (float.TryParse(X, out float x) && |
|||
float.TryParse(Y, out float y)) |
|||
{ |
|||
return new Point |
|||
{ |
|||
X = x, |
|||
Y = y |
|||
}; |
|||
} |
|||
} |
|||
|
|||
return new Point(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
using LINGYUN.Abp.Location.Baidu.Model; |
|||
|
|||
namespace LINGYUN.Abp.Location.Baidu.Response |
|||
{ |
|||
public class BaiduIpGeocodeResponse : BaiduLocationResponse |
|||
{ |
|||
public string Address { get; set; } |
|||
|
|||
public Content Content { get; set; } = new Content(); |
|||
} |
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net5.0</TargetFramework> |
|||
<RootNamespace /> |
|||
<IsPackable>false</IsPackable> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" /> |
|||
<PackageReference Include="xunit" Version="2.4.1" /> |
|||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3"> |
|||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> |
|||
<PrivateAssets>all</PrivateAssets> |
|||
</PackageReference> |
|||
<PackageReference Include="coverlet.collector" Version="1.3.0"> |
|||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> |
|||
<PrivateAssets>all</PrivateAssets> |
|||
</PackageReference> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\..\modules\common\LINGYUN.Abp.Location.Baidu\LINGYUN.Abp.Location.Baidu.csproj" /> |
|||
<ProjectReference Include="..\LINGYUN.Abp.TestBase\LINGYUN.Abp.TestsBase.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,9 @@ |
|||
using LINGYUN.Abp.Tests; |
|||
|
|||
namespace LINGYUN.Abp.Location.Baidu |
|||
{ |
|||
public class AbpLocationBaiduTestBase : AbpTestsBase<AbpLocationBaiduTestModule> |
|||
{ |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,24 @@ |
|||
using LINGYUN.Abp.Tests; |
|||
using Microsoft.Extensions.Configuration; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace LINGYUN.Abp.Location.Baidu |
|||
{ |
|||
[DependsOn( |
|||
typeof(AbpBaiduLocationModule), |
|||
typeof(AbpTestsBaseModule))] |
|||
public class AbpLocationBaiduTestModule : AbpModule |
|||
{ |
|||
public override void PreConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
var configurationOptions = new AbpConfigurationBuilderOptions |
|||
{ |
|||
BasePath = @"D:\Projects\Development\Abp\Location\Baidu", |
|||
EnvironmentName = "Development" |
|||
}; |
|||
|
|||
context.Services.ReplaceConfiguration(ConfigurationHelper.BuildConfiguration(configurationOptions)); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,58 @@ |
|||
using Shouldly; |
|||
using System.Threading.Tasks; |
|||
using Xunit; |
|||
|
|||
namespace LINGYUN.Abp.Location.Baidu |
|||
{ |
|||
public class BaiduLocationResolveProviderTests : AbpLocationBaiduTestBase |
|||
{ |
|||
private readonly ILocationResolveProvider _provider; |
|||
|
|||
public BaiduLocationResolveProviderTests() |
|||
{ |
|||
_provider = GetRequiredService<ILocationResolveProvider>(); |
|||
_provider.ShouldBeOfType<BaiduLocationResolveProvider>(); |
|||
} |
|||
|
|||
[Theory] |
|||
[InlineData(39.906049, 116.398773, 1000)] |
|||
public async Task ReGeocode_Test(double lat, double lng, int radius = 50) |
|||
{ |
|||
var location = await _provider.ReGeocodeAsync(lat, lng, radius); |
|||
|
|||
location.ShouldNotBeNull(); |
|||
location.Address.ShouldBe("北京市西城区前门西大街正阳市场4号楼"); |
|||
location.FormattedAddress.ShouldBe("前门西大街正阳市场4号楼"); |
|||
|
|||
// TODO
|
|||
} |
|||
|
|||
[Theory] |
|||
[InlineData("北京市东城区广场东侧路", "北京")] |
|||
public async Task Geocode_Test(string address, string city = "") |
|||
{ |
|||
var location = await _provider.GeocodeAsync(address, city); |
|||
|
|||
location.ShouldNotBeNull(); |
|||
location.Latitude.ShouldBe(39.91125781161926); |
|||
location.Longitude.ShouldBe(116.40588581321788); |
|||
location.Level.ShouldBe("道路"); |
|||
location.Pomprehension.ShouldBe(0); |
|||
|
|||
// TODO
|
|||
} |
|||
|
|||
[Theory] |
|||
[InlineData("111.206.145.41")] |
|||
public async Task IPGeocode_Test(string ipAddress) |
|||
{ |
|||
var location = await _provider.IPGeocodeAsync(ipAddress); |
|||
|
|||
location.ShouldNotBeNull(); |
|||
location.Location.Latitude.ShouldBe(39.91489028930664); |
|||
location.Location.Longitude.ShouldBe(116.40387725830078); |
|||
|
|||
// TODO
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net5.0</TargetFramework> |
|||
<RootNamespace /> |
|||
<IsPackable>false</IsPackable> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" /> |
|||
<PackageReference Include="xunit" Version="2.4.1" /> |
|||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3"> |
|||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> |
|||
<PrivateAssets>all</PrivateAssets> |
|||
</PackageReference> |
|||
<PackageReference Include="coverlet.collector" Version="1.3.0"> |
|||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> |
|||
<PrivateAssets>all</PrivateAssets> |
|||
</PackageReference> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\..\modules\common\LINGYUN.Abp.Location.Tencent\LINGYUN.Abp.Location.Tencent.csproj" /> |
|||
<ProjectReference Include="..\LINGYUN.Abp.TestBase\LINGYUN.Abp.TestsBase.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,9 @@ |
|||
using LINGYUN.Abp.Tests; |
|||
|
|||
namespace LINGYUN.Abp.Location.Tencent |
|||
{ |
|||
public class AbpLocationTencentTestBase : AbpTestsBase<AbpLocationTencentTestModule> |
|||
{ |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,24 @@ |
|||
using LINGYUN.Abp.Tests; |
|||
using Microsoft.Extensions.Configuration; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace LINGYUN.Abp.Location.Tencent |
|||
{ |
|||
[DependsOn( |
|||
typeof(AbpTencentLocationModule), |
|||
typeof(AbpTestsBaseModule))] |
|||
public class AbpLocationTencentTestModule : AbpModule |
|||
{ |
|||
public override void PreConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
var configurationOptions = new AbpConfigurationBuilderOptions |
|||
{ |
|||
BasePath = @"D:\Projects\Development\Abp\Location\Tencent", |
|||
EnvironmentName = "Development" |
|||
}; |
|||
|
|||
context.Services.ReplaceConfiguration(ConfigurationHelper.BuildConfiguration(configurationOptions)); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,58 @@ |
|||
using Shouldly; |
|||
using System.Threading.Tasks; |
|||
using Xunit; |
|||
|
|||
namespace LINGYUN.Abp.Location.Tencent |
|||
{ |
|||
public class TencentLocationResolveProviderTests : AbpLocationTencentTestBase |
|||
{ |
|||
private readonly ILocationResolveProvider _provider; |
|||
|
|||
public TencentLocationResolveProviderTests() |
|||
{ |
|||
_provider = GetRequiredService<ILocationResolveProvider>(); |
|||
_provider.ShouldBeOfType<TencentLocationResolveProvider>(); |
|||
} |
|||
|
|||
[Theory] |
|||
[InlineData(39.906049, 116.398773, 1000)] |
|||
public async Task ReGeocode_Test(double lat, double lng, int radius = 50) |
|||
{ |
|||
var location = await _provider.ReGeocodeAsync(lat, lng, radius); |
|||
|
|||
location.ShouldNotBeNull(); |
|||
location.Address.ShouldBe("北京市东城区东长安街"); |
|||
location.FormattedAddress.ShouldBe("天安门广场"); |
|||
|
|||
// TODO
|
|||
} |
|||
|
|||
[Theory] |
|||
[InlineData("北京市东城区广场东侧路")] |
|||
public async Task Geocode_Test(string address, string city = "") |
|||
{ |
|||
var location = await _provider.GeocodeAsync(address, city); |
|||
|
|||
location.ShouldNotBeNull(); |
|||
location.Latitude.ShouldBe(39.907631); |
|||
location.Longitude.ShouldBe(116.399384); |
|||
location.Level.ShouldBe("7"); |
|||
location.Pomprehension.ShouldBe(0); |
|||
|
|||
// TODO
|
|||
} |
|||
|
|||
[Theory] |
|||
[InlineData("111.206.145.41")] |
|||
public async Task IPGeocode_Test(string ipAddress) |
|||
{ |
|||
var location = await _provider.IPGeocodeAsync(ipAddress); |
|||
|
|||
location.ShouldNotBeNull(); |
|||
location.Location.Latitude.ShouldBe(40.0403); |
|||
location.Location.Longitude.ShouldBe(116.2734); |
|||
|
|||
// TODO
|
|||
} |
|||
} |
|||
} |
|||
@ -1,11 +1,9 @@ |
|||
. "./build-aspnetcore-common.ps1" |
|||
|
|||
# Build all solutions |
|||
foreach ($batchCommandPath in $batchCommandPaths) { |
|||
$file = [io.fileinfo]$batchCommandPath; |
|||
Write-Host $file.DirectoryName |
|||
Set-Location $file.DirectoryName |
|||
CMD /c $file.Name --ef-u -Wait |
|||
foreach ($service in $serviceArray) { |
|||
Set-Location $service.Path |
|||
dotnet ef database update |
|||
} |
|||
|
|||
Set-Location $rootFolder |
|||
@ -1,11 +1,10 @@ |
|||
. "./build-aspnetcore-common.ps1" |
|||
|
|||
# Build all solutions |
|||
foreach ($batchCommandPath in $batchCommandPaths) { |
|||
$file = [io.fileinfo]$batchCommandPath; |
|||
Write-Host $file.DirectoryName |
|||
Set-Location $file.DirectoryName |
|||
CMD /c $file.Name --publish -Wait |
|||
foreach ($service in $serviceArray) { |
|||
Set-Location $service.Path |
|||
$publishPath = $service.Path + "/../../Publish/" + $service.Service |
|||
dotnet publish -c Release -o $publishPath --no-cache --no-restore |
|||
} |
|||
|
|||
Set-Location $rootFolder |
|||
@ -0,0 +1,55 @@ |
|||
readonly workdir=$(cd $(dirname $0); pwd) |
|||
echo "当前工作目录: $workdir" |
|||
|
|||
echo "构建身份认证服务" |
|||
cd $workdir"/../aspnet-core/services/account/AuthServer.Host" |
|||
|
|||
dotnet restore |
|||
dotnet publish -c Release -o ../../Publish/identityserver --no-cache --no-restore |
|||
cp -r -f Dockerfile ../../Publish/identityserver/Dockerfile |
|||
|
|||
|
|||
echo "开始构建身份认证管理服务" |
|||
cd $workdir"/../aspnet-core/services/identity-server/LINGYUN.Abp.IdentityServer4.HttpApi.Host" |
|||
|
|||
dotnet restore |
|||
dotnet publish -c Release -o ../../Publish/identityserver4-admin --no-cache --no-restore |
|||
cp -r -f Dockerfile ../../Publish/identityserver4-admin/Dockerfile |
|||
|
|||
echo "开始构建后台管理服务" |
|||
|
|||
cd $workdir"/../aspnet-core/services/admin/LINGYUN.Abp.BackendAdmin.HttpApi.Host" |
|||
|
|||
dotnet restore |
|||
dotnet publish -c Release -o ../../Publish/admin --no-cache --no-restore |
|||
cp -r -f Dockerfile ../../Publish/admin/Dockerfile |
|||
|
|||
|
|||
echo "开始构建平台管理服务" |
|||
|
|||
cd $workdir"/../aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host" |
|||
|
|||
dotnet restore |
|||
dotnet publish -c Release -o ../../Publish/platform --no-cache --no-restore |
|||
cp -r -f Dockerfile ../../Publish/platform/Dockerfile |
|||
|
|||
echo "开始构建消息管理服务" |
|||
cd $workdir"/../aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host" |
|||
|
|||
dotnet restore |
|||
dotnet publish -c Release -o ../../Publish/messages --no-cache --no-restore |
|||
cp -r -f Dockerfile ../../Publish/messages/Dockerfile |
|||
|
|||
echo "开始构建网关管理服务" |
|||
cd $workdir"/../aspnet-core/services/apigateway/LINGYUN.ApiGateway.HttpApi.Host" |
|||
|
|||
dotnet restore |
|||
dotnet publish -c Release -o ../../Publish/apigateway-admin --no-cache --no-restore |
|||
cp -r -f Dockerfile ../../Publish/apigateway-admin/Dockerfile |
|||
|
|||
echo "开始构建网关服务" |
|||
cd $workdir"/../aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host" |
|||
|
|||
dotnet restore |
|||
dotnet publish -c Release -o ../../Publish/apigateway-host --no-cache --no-restore |
|||
cp -r -f Dockerfile ../../Publish/apigateway-host/Dockerfile |
|||
@ -0,0 +1,21 @@ |
|||
readonly workdir=$(cd $(dirname $0); pwd) |
|||
echo "当前工作目录: $workdir" |
|||
|
|||
echo "开始构建前端UI应用界面" |
|||
|
|||
cd $workdir"/../vueJs" |
|||
|
|||
rm -rf $workdir"dist/*" |
|||
|
|||
npm install --registry=http://registry.npm.taobao.org |
|||
npm run build:prod |
|||
|
|||
|
|||
rm -rf $workdir"/../aspnet-core/services/Publish/client" |
|||
mkdir -p $workdir"/../aspnet-core/services/Publish/client/docker/nginx" |
|||
|
|||
|
|||
cp -r -f $workdir/"/../vueJs/dist" $workdir"/../aspnet-core/services/Publish/client/dist" |
|||
cp -r -f $workdir/"/../vueJs/docker/nginx/nginx.conf" $workdir"/../aspnet-core/services/Publish/client/docker/nginx/nginx.conf" |
|||
cp -r -f $workdir/"/../vueJs/docker/nginx/default.conf" $workdir"/../aspnet-core/services/Publish/client/docker/nginx/default.conf" |
|||
cp -r -f $workdir/"/../vueJs/Dockerfile" $workdir"/../aspnet-core/services/Publish/client/Dockerfile" |
|||
Loading…
Reference in new issue