Browse Source

Location interface return value optimization

pull/224/head
cKey 5 years ago
parent
commit
5cb3b152a5
  1. 16
      aspnet-core/LINGYUN.MicroService.All.sln
  2. 14
      aspnet-core/LINGYUN.MicroService.Common.sln
  3. 4
      aspnet-core/modules/common/LINGYUN.Abp.Location.Baidu/LINGYUN/Abp/Location/Baidu/AbpBaiduLocationModule.cs
  4. 77
      aspnet-core/modules/common/LINGYUN.Abp.Location.Baidu/LINGYUN/Abp/Location/Baidu/BaiduLocationHttpClient.cs
  5. 2
      aspnet-core/modules/common/LINGYUN.Abp.Location.Baidu/LINGYUN/Abp/Location/Baidu/BaiduLocationOptions.cs
  6. 4
      aspnet-core/modules/common/LINGYUN.Abp.Location.Baidu/LINGYUN/Abp/Location/Baidu/BaiduLocationResolveProvider.cs
  7. 7
      aspnet-core/modules/common/LINGYUN.Abp.Location.Baidu/LINGYUN/Abp/Location/Baidu/Model/AddressComponent.cs
  8. 20
      aspnet-core/modules/common/LINGYUN.Abp.Location.Baidu/LINGYUN/Abp/Location/Baidu/Model/AddressDetail.cs
  9. 5
      aspnet-core/modules/common/LINGYUN.Abp.Location.Baidu/LINGYUN/Abp/Location/Baidu/Model/BaiduPoi.cs
  10. 11
      aspnet-core/modules/common/LINGYUN.Abp.Location.Baidu/LINGYUN/Abp/Location/Baidu/Model/BaiduReGeocode.cs
  11. 16
      aspnet-core/modules/common/LINGYUN.Abp.Location.Baidu/LINGYUN/Abp/Location/Baidu/Model/Content.cs
  12. 29
      aspnet-core/modules/common/LINGYUN.Abp.Location.Baidu/LINGYUN/Abp/Location/Baidu/Model/IpPoint.cs
  13. 2
      aspnet-core/modules/common/LINGYUN.Abp.Location.Baidu/LINGYUN/Abp/Location/Baidu/Model/PoiRegion.cs
  14. 11
      aspnet-core/modules/common/LINGYUN.Abp.Location.Baidu/LINGYUN/Abp/Location/Baidu/Response/BaiduIpGeocodeResponse.cs
  15. 7
      aspnet-core/modules/common/LINGYUN.Abp.Location.Tencent/LINGYUN/Abp/Location/Tencent/AbpTencentLocationModule.cs
  16. 2
      aspnet-core/modules/common/LINGYUN.Abp.Location.Tencent/LINGYUN/Abp/Location/Tencent/Model/Poi.cs
  17. 25
      aspnet-core/modules/common/LINGYUN.Abp.Location.Tencent/LINGYUN/Abp/Location/Tencent/TencentLocationHttpClient.cs
  18. 1
      aspnet-core/modules/common/LINGYUN.Abp.Location/LINGYUN/Abp/Location/Poi.cs
  19. 4
      aspnet-core/modules/common/LINGYUN.Abp.Location/LINGYUN/Abp/Location/ReGeocodeLocation.cs
  20. 27
      aspnet-core/tests/LINGYUN.Abp.Location.Baidu.Tests/LINGYUN.Abp.Location.Baidu.Tests.csproj
  21. 9
      aspnet-core/tests/LINGYUN.Abp.Location.Baidu.Tests/LINGYUN/Abp/Location/Baidu/AbpLocationBaiduTestBase.cs
  22. 24
      aspnet-core/tests/LINGYUN.Abp.Location.Baidu.Tests/LINGYUN/Abp/Location/Baidu/AbpLocationBaiduTestModule.cs
  23. 58
      aspnet-core/tests/LINGYUN.Abp.Location.Baidu.Tests/LINGYUN/Abp/Location/Baidu/BaiduLocationResolveProviderTests.cs
  24. 27
      aspnet-core/tests/LINGYUN.Abp.Location.Tencent.Tests/LINGYUN.Abp.Location.Tencent.Tests.csproj
  25. 9
      aspnet-core/tests/LINGYUN.Abp.Location.Tencent.Tests/LINGYUN/Abp/Location/Tencent/AbpLocationTencentTestBase.cs
  26. 24
      aspnet-core/tests/LINGYUN.Abp.Location.Tencent.Tests/LINGYUN/Abp/Location/Tencent/AbpLocationTencentTestModule.cs
  27. 58
      aspnet-core/tests/LINGYUN.Abp.Location.Tencent.Tests/LINGYUN/Abp/Location/Tencent/TencentLocationResolveProviderTests.cs
  28. 18
      build/build-aspnetcore-common.ps1
  29. 8
      build/build-aspnetcore-ef-update.ps1
  30. 9
      build/build-aspnetcore-release.ps1

16
aspnet-core/LINGYUN.MicroService.All.sln

@ -284,7 +284,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.OssManagement.F
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.OssManagement.SettingManagement", "modules\oss-management\LINGYUN.Abp.OssManagement.SettingManagement\LINGYUN.Abp.OssManagement.SettingManagement.csproj", "{BD74BE00-54E4-4979-8797-E8027695F396}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.OssManagement.SettingManagement", "modules\oss-management\LINGYUN.Abp.OssManagement.SettingManagement\LINGYUN.Abp.OssManagement.SettingManagement.csproj", "{BD74BE00-54E4-4979-8797-E8027695F396}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Features.LimitValidation.Redis.Client", "modules\common\LINGYUN.Abp.Features.LimitValidation.Redis.Client\LINGYUN.Abp.Features.LimitValidation.Redis.Client.csproj", "{48DE251A-3482-4934-BC26-F99D2235AC9F}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Features.LimitValidation.Redis.Client", "modules\common\LINGYUN.Abp.Features.LimitValidation.Redis.Client\LINGYUN.Abp.Features.LimitValidation.Redis.Client.csproj", "{48DE251A-3482-4934-BC26-F99D2235AC9F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Location.Tencent.Tests", "tests\LINGYUN.Abp.Location.Tencent.Tests\LINGYUN.Abp.Location.Tencent.Tests.csproj", "{94B47385-E47F-4FD7-A3A9-A7AA122EFC93}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Location.Baidu.Tests", "tests\LINGYUN.Abp.Location.Baidu.Tests\LINGYUN.Abp.Location.Baidu.Tests.csproj", "{C892CD81-50AE-49E5-BF44-A0C28A1614CC}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -752,6 +756,14 @@ Global
{48DE251A-3482-4934-BC26-F99D2235AC9F}.Debug|Any CPU.Build.0 = Debug|Any CPU {48DE251A-3482-4934-BC26-F99D2235AC9F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{48DE251A-3482-4934-BC26-F99D2235AC9F}.Release|Any CPU.ActiveCfg = Release|Any CPU {48DE251A-3482-4934-BC26-F99D2235AC9F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{48DE251A-3482-4934-BC26-F99D2235AC9F}.Release|Any CPU.Build.0 = Release|Any CPU {48DE251A-3482-4934-BC26-F99D2235AC9F}.Release|Any CPU.Build.0 = Release|Any CPU
{94B47385-E47F-4FD7-A3A9-A7AA122EFC93}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{94B47385-E47F-4FD7-A3A9-A7AA122EFC93}.Debug|Any CPU.Build.0 = Debug|Any CPU
{94B47385-E47F-4FD7-A3A9-A7AA122EFC93}.Release|Any CPU.ActiveCfg = Release|Any CPU
{94B47385-E47F-4FD7-A3A9-A7AA122EFC93}.Release|Any CPU.Build.0 = Release|Any CPU
{C892CD81-50AE-49E5-BF44-A0C28A1614CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C892CD81-50AE-49E5-BF44-A0C28A1614CC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C892CD81-50AE-49E5-BF44-A0C28A1614CC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C892CD81-50AE-49E5-BF44-A0C28A1614CC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@ -894,6 +906,8 @@ Global
{3E5EBCEC-78C9-4A1A-BF04-A216AA6A921F} = {B05CB08F-C088-4D6D-97EE-A94A5D1AE4A6} {3E5EBCEC-78C9-4A1A-BF04-A216AA6A921F} = {B05CB08F-C088-4D6D-97EE-A94A5D1AE4A6}
{BD74BE00-54E4-4979-8797-E8027695F396} = {B05CB08F-C088-4D6D-97EE-A94A5D1AE4A6} {BD74BE00-54E4-4979-8797-E8027695F396} = {B05CB08F-C088-4D6D-97EE-A94A5D1AE4A6}
{48DE251A-3482-4934-BC26-F99D2235AC9F} = {8AC72641-30D3-4ACF-89FA-808FADC55C2E} {48DE251A-3482-4934-BC26-F99D2235AC9F} = {8AC72641-30D3-4ACF-89FA-808FADC55C2E}
{94B47385-E47F-4FD7-A3A9-A7AA122EFC93} = {370D7CD5-1E17-4F3D-BBFA-03429F6D4F2F}
{C892CD81-50AE-49E5-BF44-A0C28A1614CC} = {370D7CD5-1E17-4F3D-BBFA-03429F6D4F2F}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C95FDF91-16F2-4A8B-A4BE-0E62D1B66718} SolutionGuid = {C95FDF91-16F2-4A8B-A4BE-0E62D1B66718}

14
aspnet-core/LINGYUN.MicroService.Common.sln

@ -111,6 +111,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Aliyun.Tests",
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Sms.Aliyun.Tests", "tests\LINGYUN.Abp.Sms.Aliyun.Tests\LINGYUN.Abp.Sms.Aliyun.Tests.csproj", "{93DD5A05-B67A-4E11-BB56-F6B4E7F1489C}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Sms.Aliyun.Tests", "tests\LINGYUN.Abp.Sms.Aliyun.Tests\LINGYUN.Abp.Sms.Aliyun.Tests.csproj", "{93DD5A05-B67A-4E11-BB56-F6B4E7F1489C}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Location.Baidu.Tests", "tests\LINGYUN.Abp.Location.Baidu.Tests\LINGYUN.Abp.Location.Baidu.Tests.csproj", "{221725FF-6C01-4F41-9F29-AC04C7D52611}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Location.Tencent.Tests", "tests\LINGYUN.Abp.Location.Tencent.Tests\LINGYUN.Abp.Location.Tencent.Tests.csproj", "{1B494EA1-28CF-4A61-B0BE-70BBA425C316}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -289,6 +293,14 @@ Global
{93DD5A05-B67A-4E11-BB56-F6B4E7F1489C}.Debug|Any CPU.Build.0 = Debug|Any CPU {93DD5A05-B67A-4E11-BB56-F6B4E7F1489C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{93DD5A05-B67A-4E11-BB56-F6B4E7F1489C}.Release|Any CPU.ActiveCfg = Release|Any CPU {93DD5A05-B67A-4E11-BB56-F6B4E7F1489C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{93DD5A05-B67A-4E11-BB56-F6B4E7F1489C}.Release|Any CPU.Build.0 = Release|Any CPU {93DD5A05-B67A-4E11-BB56-F6B4E7F1489C}.Release|Any CPU.Build.0 = Release|Any CPU
{221725FF-6C01-4F41-9F29-AC04C7D52611}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{221725FF-6C01-4F41-9F29-AC04C7D52611}.Debug|Any CPU.Build.0 = Debug|Any CPU
{221725FF-6C01-4F41-9F29-AC04C7D52611}.Release|Any CPU.ActiveCfg = Release|Any CPU
{221725FF-6C01-4F41-9F29-AC04C7D52611}.Release|Any CPU.Build.0 = Release|Any CPU
{1B494EA1-28CF-4A61-B0BE-70BBA425C316}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1B494EA1-28CF-4A61-B0BE-70BBA425C316}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1B494EA1-28CF-4A61-B0BE-70BBA425C316}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1B494EA1-28CF-4A61-B0BE-70BBA425C316}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@ -346,6 +358,8 @@ Global
{8FB74B18-CA5C-4DC3-8DFA-600133A05712} = {8D2AD50B-DD4B-48A2-88EC-0E8E8236D883} {8FB74B18-CA5C-4DC3-8DFA-600133A05712} = {8D2AD50B-DD4B-48A2-88EC-0E8E8236D883}
{3DBF0975-B09D-49CA-9AF8-69175EDB9D52} = {B86C21A4-73B7-471E-B73A-B4B905EC9435} {3DBF0975-B09D-49CA-9AF8-69175EDB9D52} = {B86C21A4-73B7-471E-B73A-B4B905EC9435}
{93DD5A05-B67A-4E11-BB56-F6B4E7F1489C} = {B86C21A4-73B7-471E-B73A-B4B905EC9435} {93DD5A05-B67A-4E11-BB56-F6B4E7F1489C} = {B86C21A4-73B7-471E-B73A-B4B905EC9435}
{221725FF-6C01-4F41-9F29-AC04C7D52611} = {B86C21A4-73B7-471E-B73A-B4B905EC9435}
{1B494EA1-28CF-4A61-B0BE-70BBA425C316} = {B86C21A4-73B7-471E-B73A-B4B905EC9435}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {06C707C6-02C0-411A-AD3B-2D0E13787CB8} SolutionGuid = {06C707C6-02C0-411A-AD3B-2D0E13787CB8}

4
aspnet-core/modules/common/LINGYUN.Abp.Location.Baidu/LINGYUN/Abp/Location/Baidu/AbpBaiduLocationModule.cs

@ -5,13 +5,15 @@ using System;
using Volo.Abp.Json; using Volo.Abp.Json;
using Volo.Abp.Localization; using Volo.Abp.Localization;
using Volo.Abp.Modularity; using Volo.Abp.Modularity;
using Volo.Abp.Threading;
using Volo.Abp.VirtualFileSystem; using Volo.Abp.VirtualFileSystem;
namespace LINGYUN.Abp.Location.Baidu namespace LINGYUN.Abp.Location.Baidu
{ {
[DependsOn( [DependsOn(
typeof(AbpLocationModule), typeof(AbpLocationModule),
typeof(AbpJsonModule))] typeof(AbpJsonModule),
typeof(AbpThreadingModule))]
public class AbpBaiduLocationModule : AbpModule public class AbpBaiduLocationModule : AbpModule
{ {
public override void ConfigureServices(ServiceConfigurationContext context) public override void ConfigureServices(ServiceConfigurationContext context)

77
aspnet-core/modules/common/LINGYUN.Abp.Location.Baidu/LINGYUN/Abp/Location/Baidu/BaiduLocationHttpClient.cs

@ -40,6 +40,54 @@ namespace LINGYUN.Abp.Location.Baidu
CancellationTokenProvider = cancellationTokenProvider; CancellationTokenProvider = cancellationTokenProvider;
} }
public virtual async Task<IPGecodeLocation> IPGeocodeAsync(string ipAddress)
{
var requestParamters = new Dictionary<string, string>
{
{ "ip", ipAddress },
{ "ak", Options.AccessKey },
{ "coor", Options.CoordType }
};
var baiduMapUrl = "http://api.map.baidu.com";
var baiduMapPath = "/location/ip";
if (Options.CaculateAKSN)
{
// TODO: 百度的文档不明不白,sn的算法在遇到特殊字符会验证失败,有待完善
var sn = BaiduAKSNCaculater.CaculateAKSN(Options.AccessSecret, baiduMapPath, requestParamters);
requestParamters.Add("sn", sn);
}
var requestUrl = BuildRequestUrl(baiduMapUrl, baiduMapPath, requestParamters);
var responseContent = await MakeRequestAndGetResultAsync(requestUrl);
var baiduLocationResponse = JsonSerializer.Deserialize<BaiduIpGeocodeResponse>(responseContent);
if (!baiduLocationResponse.IsSuccess())
{
var localizerFactory = ServiceProvider.GetRequiredService<IStringLocalizerFactory>();
var localizerErrorMessage = baiduLocationResponse.GetErrorMessage(Options.VisableErrorToClient).Localize(localizerFactory);
var localizerErrorDescription = baiduLocationResponse.GetErrorMessage(Options.VisableErrorToClient).Localize(localizerFactory);
var localizer = ServiceProvider.GetRequiredService<IStringLocalizer<BaiduLocationResource>>();
localizerErrorMessage = localizer["ResolveLocationFailed", localizerErrorMessage, localizerErrorDescription];
if (Options.VisableErrorToClient)
{
throw new UserFriendlyException(localizerErrorMessage);
}
throw new AbpException($"Resolution address failed:{localizerErrorMessage}!");
}
var location = new IPGecodeLocation
{
Province = baiduLocationResponse.Content.AddressDetail?.Province,
City = baiduLocationResponse.Content.AddressDetail?.City,
AdCode = baiduLocationResponse.Content.AddressDetail?.CityCode.ToString(),
};
var point = baiduLocationResponse.Content.Point.ToPoint();
location.Location.Latitude = point.Y;
location.Location.Longitude = point.X;
location.AddAdditional("Address", baiduLocationResponse.Address);
location.AddAdditional("Content", baiduLocationResponse.Content);
return location;
}
public virtual async Task<GecodeLocation> GeocodeAsync(string address, string city = null) public virtual async Task<GecodeLocation> GeocodeAsync(string address, string city = null)
{ {
var requestParamters = new Dictionary<string, string> var requestParamters = new Dictionary<string, string>
@ -133,25 +181,42 @@ namespace LINGYUN.Abp.Location.Baidu
{ {
Street = baiduLocationResponse.Result.AddressComponent.Street, Street = baiduLocationResponse.Result.AddressComponent.Street,
AdCode = baiduLocationResponse.Result.AddressComponent.AdCode.ToString(), AdCode = baiduLocationResponse.Result.AddressComponent.AdCode.ToString(),
Address = baiduLocationResponse.Result.Address, Address = baiduLocationResponse.Result.FormattedAddress,
FormattedAddress = baiduLocationResponse.Result.SematicDescription,
City = baiduLocationResponse.Result.AddressComponent.City, City = baiduLocationResponse.Result.AddressComponent.City,
Country = baiduLocationResponse.Result.AddressComponent.Country, Country = baiduLocationResponse.Result.AddressComponent.Country,
District = baiduLocationResponse.Result.AddressComponent.District, District = baiduLocationResponse.Result.AddressComponent.District,
Number = baiduLocationResponse.Result.AddressComponent.StreetNumber, Number = baiduLocationResponse.Result.AddressComponent.StreetNumber,
Province = baiduLocationResponse.Result.AddressComponent.Province, Province = baiduLocationResponse.Result.AddressComponent.Province,
Town = baiduLocationResponse.Result.AddressComponent.Town, Town = baiduLocationResponse.Result.AddressComponent.Town,
Pois = baiduLocationResponse.Result.Pois.Select(p => new Poi Pois = baiduLocationResponse.Result.Pois.Select(p =>
{ {
Address = p.Address, var poi = new Poi
Name = p.Name, {
Tag = p.Tag, Address = p.Address,
Type = p.PoiType Name = p.Name,
Tag = p.Tag,
Type = p.PoiType
};
if (int.TryParse(p.Distance, out int distance))
{
poi.Distance = distance;
}
return poi;
}).ToList(), }).ToList(),
Roads = baiduLocationResponse.Result.Roads.Select(r => new Road Roads = baiduLocationResponse.Result.Roads.Select(r => new Road
{ {
Name = r.Name Name = r.Name
}).ToList() }).ToList()
}; };
// 如果存在Poi组,取最近的一个poi作为实际地址
if (location.Pois.Any())
{
var nearPoi = location.Pois.OrderBy(x => x.Distance).FirstOrDefault();
location.Address = nearPoi.Address;
location.FormattedAddress = nearPoi.Name;
}
location.AddAdditional("BaiduLocation", baiduLocationResponse.Result); location.AddAdditional("BaiduLocation", baiduLocationResponse.Result);
return location; return location;

2
aspnet-core/modules/common/LINGYUN.Abp.Location.Baidu/LINGYUN/Abp/Location/Baidu/BaiduLocationOptions.cs

@ -35,7 +35,7 @@ namespace LINGYUN.Abp.Location.Baidu
/// extensions_poi=1,返回pois数据, /// extensions_poi=1,返回pois数据,
/// 默认显示周边1000米内的poi。 /// 默认显示周边1000米内的poi。
/// </summary> /// </summary>
public string ExtensionsPoi { get; set; } = "0"; public string ExtensionsPoi { get; set; } = "1";
/// <summary> /// <summary>
/// 当取值为true时,召回坐标周围最近的3条道路数据。 /// 当取值为true时,召回坐标周围最近的3条道路数据。
/// 区别于行政区划中的street参数(street参数为行政区划中的街道,和普通道路不对应) /// 区别于行政区划中的street参数(street参数为行政区划中的街道,和普通道路不对应)

4
aspnet-core/modules/common/LINGYUN.Abp.Location.Baidu/LINGYUN/Abp/Location/Baidu/BaiduLocationResolveProvider.cs

@ -15,9 +15,9 @@ namespace LINGYUN.Abp.Location.Baidu
BaiduLocationHttpClient = baiduHttpRequestClient; BaiduLocationHttpClient = baiduHttpRequestClient;
} }
public virtual Task<IPGecodeLocation> IPGeocodeAsync(string ipAddress) public virtual async Task<IPGecodeLocation> IPGeocodeAsync(string ipAddress)
{ {
return Task.FromResult(new IPGecodeLocation()); return await BaiduLocationHttpClient.IPGeocodeAsync(ipAddress);
} }
public virtual async Task<ReGeocodeLocation> ReGeocodeAsync(double lat, double lng, int radius = 50) public virtual async Task<ReGeocodeLocation> ReGeocodeAsync(double lat, double lng, int radius = 50)

7
aspnet-core/modules/common/LINGYUN.Abp.Location.Baidu/LINGYUN/Abp/Location/Baidu/Model/AddressComponent.cs

@ -2,6 +2,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.Text.Json.Serialization;
namespace LINGYUN.Abp.Location.Baidu.Model namespace LINGYUN.Abp.Location.Baidu.Model
{ {
@ -15,16 +16,19 @@ namespace LINGYUN.Abp.Location.Baidu.Model
/// 国家国家编码 /// 国家国家编码
/// </summary> /// </summary>
[JsonProperty("country_code")] [JsonProperty("country_code")]
[JsonPropertyName("country_code")]
public int CountryCode { get; set; } public int CountryCode { get; set; }
/// <summary> /// <summary>
/// 国家英文缩写(三位) /// 国家英文缩写(三位)
/// </summary> /// </summary>
[JsonProperty("country_code_iso")] [JsonProperty("country_code_iso")]
[JsonPropertyName("country_code_iso")]
public string CountryCodeIso { get; set; } public string CountryCodeIso { get; set; }
/// <summary> /// <summary>
/// 国家英文缩写(两位) /// 国家英文缩写(两位)
/// </summary> /// </summary>
[JsonProperty("country_code_iso2")] [JsonProperty("country_code_iso2")]
[JsonPropertyName("country_code_iso2")]
public string CountryCodeIso2 { get; set; } public string CountryCodeIso2 { get; set; }
/// <summary> /// <summary>
/// 省名 /// 省名
@ -40,6 +44,7 @@ namespace LINGYUN.Abp.Location.Baidu.Model
/// country、province、city、district、town分别对应0-4级,若city_level=3,则district层级为该国家的city层级) /// country、province、city、district、town分别对应0-4级,若city_level=3,则district层级为该国家的city层级)
/// </summary> /// </summary>
[JsonProperty("city_level")] [JsonProperty("city_level")]
[JsonPropertyName("city_level")]
public int CityLevel { get; set; } public int CityLevel { get; set; }
/// <summary> /// <summary>
/// 区县名 /// 区县名
@ -53,6 +58,7 @@ namespace LINGYUN.Abp.Location.Baidu.Model
/// 乡镇id /// 乡镇id
/// </summary> /// </summary>
[JsonProperty("town_code")] [JsonProperty("town_code")]
[JsonPropertyName("town_code")]
public string TownCode { get; set; } public string TownCode { get; set; }
/// <summary> /// <summary>
/// 街道名(行政区划中的街道层级) /// 街道名(行政区划中的街道层级)
@ -62,6 +68,7 @@ namespace LINGYUN.Abp.Location.Baidu.Model
/// 街道门牌号 /// 街道门牌号
/// </summary> /// </summary>
[JsonProperty("street_number")] [JsonProperty("street_number")]
[JsonPropertyName("street_number")]
public string StreetNumber { get; set; } public string StreetNumber { get; set; }
/// <summary> /// <summary>
/// 行政区划代码 /// 行政区划代码

20
aspnet-core/modules/common/LINGYUN.Abp.Location.Baidu/LINGYUN/Abp/Location/Baidu/Model/AddressDetail.cs

@ -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; }
}
}

5
aspnet-core/modules/common/LINGYUN.Abp.Location.Baidu/LINGYUN/Abp/Location/Baidu/Model/BaiduPoi.cs

@ -1,4 +1,5 @@
using Newtonsoft.Json; using Newtonsoft.Json;
using System.Text.Json.Serialization;
namespace LINGYUN.Abp.Location.Baidu.Model namespace LINGYUN.Abp.Location.Baidu.Model
{ {
@ -8,6 +9,7 @@ namespace LINGYUN.Abp.Location.Baidu.Model
/// 地址信息 /// 地址信息
/// </summary> /// </summary>
[JsonProperty("addr")] [JsonProperty("addr")]
[JsonPropertyName("addr")]
public string Address { get; set; } public string Address { get; set; }
/// <summary> /// <summary>
/// 名称 /// 名称
@ -38,6 +40,7 @@ namespace LINGYUN.Abp.Location.Baidu.Model
/// 电话 /// 电话
/// </summary> /// </summary>
[JsonProperty("tel")] [JsonProperty("tel")]
[JsonPropertyName("tel")]
public string TelPhone { get; set; } public string TelPhone { get; set; }
/// <summary> /// <summary>
/// poi唯一标识 /// poi唯一标识
@ -47,12 +50,14 @@ namespace LINGYUN.Abp.Location.Baidu.Model
/// 邮编 /// 邮编
/// </summary> /// </summary>
[JsonProperty("zip")] [JsonProperty("zip")]
[JsonPropertyName("zip")]
public string Post { get; set; } public string Post { get; set; }
/// <summary> /// <summary>
/// poi对应的主点poi(如,海底捞的主点为上地华联,该字段则为上地华联的poi信息。 /// poi对应的主点poi(如,海底捞的主点为上地华联,该字段则为上地华联的poi信息。
/// 如无,该字段为空),包含子字段和pois基础召回字段相同。 /// 如无,该字段为空),包含子字段和pois基础召回字段相同。
/// </summary> /// </summary>
[JsonProperty("parent_poi")] [JsonProperty("parent_poi")]
[JsonPropertyName("parent_poi")]
public BaiduPoi ParentPoi { get; set; } public BaiduPoi ParentPoi { get; set; }
} }
} }

11
aspnet-core/modules/common/LINGYUN.Abp.Location.Baidu/LINGYUN/Abp/Location/Baidu/Model/BaiduReGeocode.cs

@ -1,15 +1,23 @@
using Newtonsoft.Json; using Newtonsoft.Json;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace LINGYUN.Abp.Location.Baidu.Model namespace LINGYUN.Abp.Location.Baidu.Model
{ {
public class BaiduReGeocode public class BaiduReGeocode
{ {
/// <summary>
/// 经纬度坐标
/// </summary>
[JsonProperty("location")]
[JsonPropertyName("location")]
public BaiduLocation Location { get; set; }
/// <summary> /// <summary>
/// 结构化地址信息 /// 结构化地址信息
/// </summary> /// </summary>
[JsonProperty("formatted_address")] [JsonProperty("formatted_address")]
public string Address { get; set; } [JsonPropertyName("formatted_address")]
public string FormattedAddress { get; set; }
/// <summary> /// <summary>
/// 坐标所在商圈信息,如 "人民大学,中关村,苏州街"。 /// 坐标所在商圈信息,如 "人民大学,中关村,苏州街"。
/// 最多返回3个。 /// 最多返回3个。
@ -35,6 +43,7 @@ namespace LINGYUN.Abp.Location.Baidu.Model
/// 当前位置结合POI的语义化结果描述 /// 当前位置结合POI的语义化结果描述
/// </summary> /// </summary>
[JsonProperty("sematic_description")] [JsonProperty("sematic_description")]
[JsonPropertyName("sematic_description")]
public string SematicDescription { get; set; } public string SematicDescription { get; set; }
public BaiduReGeocode() public BaiduReGeocode()
{ {

16
aspnet-core/modules/common/LINGYUN.Abp.Location.Baidu/LINGYUN/Abp/Location/Baidu/Model/Content.cs

@ -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();
}
}

29
aspnet-core/modules/common/LINGYUN.Abp.Location.Baidu/LINGYUN/Abp/Location/Baidu/Model/IpPoint.cs

@ -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();
}
}
}

2
aspnet-core/modules/common/LINGYUN.Abp.Location.Baidu/LINGYUN/Abp/Location/Baidu/Model/PoiRegion.cs

@ -1,4 +1,5 @@
using Newtonsoft.Json; using Newtonsoft.Json;
using System.Text.Json.Serialization;
namespace LINGYUN.Abp.Location.Baidu.Model namespace LINGYUN.Abp.Location.Baidu.Model
{ {
@ -19,6 +20,7 @@ namespace LINGYUN.Abp.Location.Baidu.Model
/// 请求中的坐标与所归属区域面的相对位置关系 /// 请求中的坐标与所归属区域面的相对位置关系
/// </summary> /// </summary>
[JsonProperty("direction_desc")] [JsonProperty("direction_desc")]
[JsonPropertyName("direction_desc")]
public string DirectionDesc { get; set; } public string DirectionDesc { get; set; }
/// <summary> /// <summary>
/// poi唯一标识 /// poi唯一标识

11
aspnet-core/modules/common/LINGYUN.Abp.Location.Baidu/LINGYUN/Abp/Location/Baidu/Response/BaiduIpGeocodeResponse.cs

@ -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();
}
}

7
aspnet-core/modules/common/LINGYUN.Abp.Location.Tencent/LINGYUN/Abp/Location/Tencent/AbpTencentLocationModule.cs

@ -2,13 +2,18 @@
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Polly; using Polly;
using System; using System;
using Volo.Abp.Json;
using Volo.Abp.Localization; using Volo.Abp.Localization;
using Volo.Abp.Modularity; using Volo.Abp.Modularity;
using Volo.Abp.Threading;
using Volo.Abp.VirtualFileSystem; using Volo.Abp.VirtualFileSystem;
namespace LINGYUN.Abp.Location.Tencent namespace LINGYUN.Abp.Location.Tencent
{ {
[DependsOn(typeof(AbpLocationModule))] [DependsOn(
typeof(AbpLocationModule),
typeof(AbpJsonModule),
typeof(AbpThreadingModule))]
public class AbpTencentLocationModule : AbpModule public class AbpTencentLocationModule : AbpModule
{ {
public override void ConfigureServices(ServiceConfigurationContext context) public override void ConfigureServices(ServiceConfigurationContext context)

2
aspnet-core/modules/common/LINGYUN.Abp.Location.Tencent/LINGYUN/Abp/Location/Tencent/Model/Poi.cs

@ -36,7 +36,7 @@ namespace LINGYUN.Abp.Location.Tencent.Model
/// 该POI到逆地址解析传入的坐标的直线距离 /// 该POI到逆地址解析传入的坐标的直线距离
/// </summary> /// </summary>
[JsonProperty("_distance")] [JsonProperty("_distance")]
public string Distance { get; set; } public double Distance { get; set; }
/// <summary> /// <summary>
/// 行政区划信息 /// 行政区划信息
/// </summary> /// </summary>

25
aspnet-core/modules/common/LINGYUN.Abp.Location.Tencent/LINGYUN/Abp/Location/Tencent/TencentLocationHttpClient.cs

@ -134,20 +134,35 @@ namespace LINGYUN.Abp.Location.Tencent
Street = tencentLocationResponse.Result.AddressComponent.Street, Street = tencentLocationResponse.Result.AddressComponent.Street,
AdCode = tencentLocationResponse.Result.AddressInfo?.NationCode, AdCode = tencentLocationResponse.Result.AddressInfo?.NationCode,
Address = tencentLocationResponse.Result.Address, Address = tencentLocationResponse.Result.Address,
FormattedAddress = tencentLocationResponse.Result.FormattedAddress?.ReCommend,
City = tencentLocationResponse.Result.AddressComponent.City, City = tencentLocationResponse.Result.AddressComponent.City,
Country = tencentLocationResponse.Result.AddressComponent.Nation, Country = tencentLocationResponse.Result.AddressComponent.Nation,
District = tencentLocationResponse.Result.AddressComponent.District, District = tencentLocationResponse.Result.AddressComponent.District,
Number = tencentLocationResponse.Result.AddressComponent.StreetNumber, Number = tencentLocationResponse.Result.AddressComponent.StreetNumber,
Province = tencentLocationResponse.Result.AddressComponent.Province, Province = tencentLocationResponse.Result.AddressComponent.Province,
Town = tencentLocationResponse.Result.AddressReference.Town.Title, Town = tencentLocationResponse.Result.AddressReference.Town.Title,
Pois = tencentLocationResponse.Result.Pois.Select(p => new Poi Pois = tencentLocationResponse.Result.Pois.Select(p =>
{ {
Address = p.Address, var poi = new Poi
Name = p.Title, {
Tag = p.Id, Address = p.Address,
Type = p.CateGory Name = p.Title,
Tag = p.Id,
Type = p.CateGory,
Distance = Convert.ToInt32(p.Distance)
};
return poi;
}).ToList() }).ToList()
}; };
if ((location.Address.IsNullOrWhiteSpace() ||
location.FormattedAddress.IsNullOrWhiteSpace()) &&
location.Pois.Any())
{
var nearPoi = location.Pois.OrderBy(x => x.Distance).FirstOrDefault();
location.Address = nearPoi.Address;
location.FormattedAddress = nearPoi.Name;
}
location.AddAdditional("TencentLocation", tencentLocationResponse.Result); location.AddAdditional("TencentLocation", tencentLocationResponse.Result);
return location; return location;

1
aspnet-core/modules/common/LINGYUN.Abp.Location/LINGYUN/Abp/Location/Poi.cs

@ -6,5 +6,6 @@
public string Name { get; set; } public string Name { get; set; }
public string Type { get; set; } public string Type { get; set; }
public string Address { get; set; } public string Address { get; set; }
public int? Distance { get; set; }
} }
} }

4
aspnet-core/modules/common/LINGYUN.Abp.Location/LINGYUN/Abp/Location/ReGeocodeLocation.cs

@ -12,6 +12,10 @@ namespace LINGYUN.Abp.Location
/// </summary> /// </summary>
public string Address { get; set; } public string Address { get; set; }
/// <summary> /// <summary>
/// 格式化的地址描述
/// </summary>
public string FormattedAddress { get; set; }
/// <summary>
/// 国家 /// 国家
/// </summary> /// </summary>
public string Country { get; set; } public string Country { get; set; }

27
aspnet-core/tests/LINGYUN.Abp.Location.Baidu.Tests/LINGYUN.Abp.Location.Baidu.Tests.csproj

@ -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>

9
aspnet-core/tests/LINGYUN.Abp.Location.Baidu.Tests/LINGYUN/Abp/Location/Baidu/AbpLocationBaiduTestBase.cs

@ -0,0 +1,9 @@
using LINGYUN.Abp.Tests;
namespace LINGYUN.Abp.Location.Baidu
{
public class AbpLocationBaiduTestBase : AbpTestsBase<AbpLocationBaiduTestModule>
{
}
}

24
aspnet-core/tests/LINGYUN.Abp.Location.Baidu.Tests/LINGYUN/Abp/Location/Baidu/AbpLocationBaiduTestModule.cs

@ -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));
}
}
}

58
aspnet-core/tests/LINGYUN.Abp.Location.Baidu.Tests/LINGYUN/Abp/Location/Baidu/BaiduLocationResolveProviderTests.cs

@ -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
}
}
}

27
aspnet-core/tests/LINGYUN.Abp.Location.Tencent.Tests/LINGYUN.Abp.Location.Tencent.Tests.csproj

@ -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>

9
aspnet-core/tests/LINGYUN.Abp.Location.Tencent.Tests/LINGYUN/Abp/Location/Tencent/AbpLocationTencentTestBase.cs

@ -0,0 +1,9 @@
using LINGYUN.Abp.Tests;
namespace LINGYUN.Abp.Location.Tencent
{
public class AbpLocationTencentTestBase : AbpTestsBase<AbpLocationTencentTestModule>
{
}
}

24
aspnet-core/tests/LINGYUN.Abp.Location.Tencent.Tests/LINGYUN/Abp/Location/Tencent/AbpLocationTencentTestModule.cs

@ -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));
}
}
}

58
aspnet-core/tests/LINGYUN.Abp.Location.Tencent.Tests/LINGYUN/Abp/Location/Tencent/TencentLocationResolveProviderTests.cs

@ -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
}
}
}

18
build/build-aspnetcore-common.ps1

@ -3,15 +3,15 @@
$rootFolder = (Get-Item -Path "./" -Verbose).FullName $rootFolder = (Get-Item -Path "./" -Verbose).FullName
# List of solutions used only in development mode # List of solutions used only in development mode
$batchCommandPaths = @( [PsObject[]]$serviceArray = @()
"../aspnet-core/services/start-auth-server.bat",
"../aspnet-core/services/start-identity-server.bat", $serviceArray += [PsObject]@{ Path = $rootFolder + "/../aspnet-core/services/account/AuthServer.Host"; Service = "identityserver" }
"../aspnet-core/services/start-backend-admin.bat", $serviceArray += [PsObject]@{ Path = $rootFolder + "/../aspnet-core/services/admin/LINGYUN.Abp.BackendAdmin.HttpApi.Host"; Service = "admin" }
"../aspnet-core/services/start-apigateway-host.bat", $serviceArray += [PsObject]@{ Path = $rootFolder + "/../aspnet-core/services/identity-server/LINGYUN.Abp.IdentityServer4.HttpApi.Host"; Service = "identityserver4-admin" }
"../aspnet-core/services/start-apigateway-admin.bat", $serviceArray += [PsObject]@{ Path = $rootFolder + "/../aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host"; Service = "apigateway-host" }
"../aspnet-core/services/start-messages.bat", $serviceArray += [PsObject]@{ Path = $rootFolder + "/../aspnet-core/services/apigateway/LINGYUN.ApiGateway.HttpApi.Host"; Service = "apigateway-admin" }
"../aspnet-core/services/start-platform.bat" $serviceArray += [PsObject]@{ Path = $rootFolder + "/../aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host"; Service = "messages" }
) $serviceArray += [PsObject]@{ Path = $rootFolder + "/../aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host"; Service = "platform" }
Write-host "" Write-host ""
Write-host ":::::::::::::: !!! You are in development mode !!! ::::::::::::::" -ForegroundColor red -BackgroundColor yellow Write-host ":::::::::::::: !!! You are in development mode !!! ::::::::::::::" -ForegroundColor red -BackgroundColor yellow

8
build/build-aspnetcore-ef-update.ps1

@ -1,11 +1,9 @@
. "./build-aspnetcore-common.ps1" . "./build-aspnetcore-common.ps1"
# Build all solutions # Build all solutions
foreach ($batchCommandPath in $batchCommandPaths) { foreach ($service in $serviceArray) {
$file = [io.fileinfo]$batchCommandPath; Set-Location $service.Path
Write-Host $file.DirectoryName dotnet ef database update
Set-Location $file.DirectoryName
CMD /c $file.Name --ef-u -Wait
} }
Set-Location $rootFolder Set-Location $rootFolder

9
build/build-aspnetcore-release.ps1

@ -1,11 +1,10 @@
. "./build-aspnetcore-common.ps1" . "./build-aspnetcore-common.ps1"
# Build all solutions # Build all solutions
foreach ($batchCommandPath in $batchCommandPaths) { foreach ($service in $serviceArray) {
$file = [io.fileinfo]$batchCommandPath; Set-Location $service.Path
Write-Host $file.DirectoryName $publishPath = $service.Path + "/../../Publish/" + $service.Service
Set-Location $file.DirectoryName dotnet publish -c Release -o $publishPath --no-cache --no-restore
CMD /c $file.Name --publish -Wait
} }
Set-Location $rootFolder Set-Location $rootFolder
Loading…
Cancel
Save