diff --git "a/MapApi/Locations/\345\234\260\345\233\276\346\217\220\344\276\233\350\200\205.Biz.cs" "b/MapApi/Locations/\345\234\260\345\233\276\346\217\220\344\276\233\350\200\205.Biz.cs"
index 53336cc..8931a51 100644
--- "a/MapApi/Locations/\345\234\260\345\233\276\346\217\220\344\276\233\350\200\205.Biz.cs"
+++ "b/MapApi/Locations/\345\234\260\345\233\276\346\217\220\344\276\233\350\200\205.Biz.cs"
@@ -122,7 +122,7 @@ public static MapProvider FindById(Int32 id)
/// 实体列表
public static IList FindAllByKind(NewLife.Map.Models.MapKinds kind)
{
- if (kind <= 0) return new List();
+ if (kind <= 0) return [];
// 实体缓存
if (Meta.Session.Count < 1000) return Meta.Cache.FindAll(e => e.Kind == kind);
diff --git "a/MapApi/Locations/\345\234\260\347\220\206\346\225\260\346\215\2566\344\275\215.Biz.cs" "b/MapApi/Locations/\345\234\260\347\220\206\346\225\260\346\215\2566\344\275\215.Biz.cs"
index 97d9b0d..4677df4 100644
--- "a/MapApi/Locations/\345\234\260\347\220\206\346\225\260\346\215\2566\344\275\215.Biz.cs"
+++ "b/MapApi/Locations/\345\234\260\347\220\206\346\225\260\346\215\2566\344\275\215.Biz.cs"
@@ -1,4 +1,4 @@
-using NewLife;
+using NewLife;
using NewLife.Data;
using XCode;
using XCode.Membership;
@@ -146,7 +146,7 @@ public static IList FindAllByCode(Int32 code)
/// 实体列表
public static IList FindAllByHash(String hash)
{
- if (hash.IsNullOrEmpty()) return new List();
+ if (hash.IsNullOrEmpty()) return [];
// 实体缓存
if (Meta.Session.Count < 1000) return Meta.Cache.FindAll(e => e.Hash.EqualIgnoreCase(hash));
@@ -159,7 +159,7 @@ public static IList FindAllByHash(String hash)
/// 实体列表
public static IList FindAllByHashBd09(String hashBd09)
{
- if (hashBd09.IsNullOrEmpty()) return new List();
+ if (hashBd09.IsNullOrEmpty()) return [];
// 实体缓存
if (Meta.Session.Count < 1000) return Meta.Cache.FindAll(e => e.HashBd09.EqualIgnoreCase(hashBd09));
@@ -172,7 +172,7 @@ public static IList FindAllByHashBd09(String hashBd09)
/// 实体列表
public static IList FindAllByHashGcj02(String hashGcj02)
{
- if (hashGcj02.IsNullOrEmpty()) return new List();
+ if (hashGcj02.IsNullOrEmpty()) return [];
// 实体缓存
if (Meta.Session.Count < 1000) return Meta.Cache.FindAll(e => e.HashGcj02.EqualIgnoreCase(hashGcj02));
diff --git "a/MapApi/Locations/\345\234\260\347\220\206\346\225\260\346\215\2567\344\275\215.Biz.cs" "b/MapApi/Locations/\345\234\260\347\220\206\346\225\260\346\215\2567\344\275\215.Biz.cs"
index 05c08b4..b539d33 100644
--- "a/MapApi/Locations/\345\234\260\347\220\206\346\225\260\346\215\2567\344\275\215.Biz.cs"
+++ "b/MapApi/Locations/\345\234\260\347\220\206\346\225\260\346\215\2567\344\275\215.Biz.cs"
@@ -143,7 +143,7 @@ public static IList FindAllByCode(Int32 code)
/// 实体列表
public static IList FindAllByHash(String hash)
{
- if (hash.IsNullOrEmpty()) return new List();
+ if (hash.IsNullOrEmpty()) return [];
// 实体缓存
if (Meta.Session.Count < 1000) return Meta.Cache.FindAll(e => e.Hash.EqualIgnoreCase(hash));
@@ -156,7 +156,7 @@ public static IList FindAllByHash(String hash)
/// 实体列表
public static IList FindAllByHashBd09(String hashBd09)
{
- if (hashBd09.IsNullOrEmpty()) return new List();
+ if (hashBd09.IsNullOrEmpty()) return [];
// 实体缓存
if (Meta.Session.Count < 1000) return Meta.Cache.FindAll(e => e.HashBd09.EqualIgnoreCase(hashBd09));
@@ -169,7 +169,7 @@ public static IList FindAllByHashBd09(String hashBd09)
/// 实体列表
public static IList FindAllByHashGcj02(String hashGcj02)
{
- if (hashGcj02.IsNullOrEmpty()) return new List();
+ if (hashGcj02.IsNullOrEmpty()) return [];
// 实体缓存
if (Meta.Session.Count < 1000) return Meta.Cache.FindAll(e => e.HashGcj02.EqualIgnoreCase(hashGcj02));
diff --git "a/MapApi/Locations/\345\234\260\347\220\206\346\225\260\346\215\2568\344\275\215.Biz.cs" "b/MapApi/Locations/\345\234\260\347\220\206\346\225\260\346\215\2568\344\275\215.Biz.cs"
index 005d94e..96c4465 100644
--- "a/MapApi/Locations/\345\234\260\347\220\206\346\225\260\346\215\2568\344\275\215.Biz.cs"
+++ "b/MapApi/Locations/\345\234\260\347\220\206\346\225\260\346\215\2568\344\275\215.Biz.cs"
@@ -143,7 +143,7 @@ public static IList FindAllByCode(Int32 code)
/// 实体列表
public static IList FindAllByHash(String hash)
{
- if (hash.IsNullOrEmpty()) return new List();
+ if (hash.IsNullOrEmpty()) return [];
// 实体缓存
if (Meta.Session.Count < 1000) return Meta.Cache.FindAll(e => e.Hash.EqualIgnoreCase(hash));
@@ -156,7 +156,7 @@ public static IList FindAllByHash(String hash)
/// 实体列表
public static IList FindAllByHashBd09(String hashBd09)
{
- if (hashBd09.IsNullOrEmpty()) return new List();
+ if (hashBd09.IsNullOrEmpty()) return [];
// 实体缓存
if (Meta.Session.Count < 1000) return Meta.Cache.FindAll(e => e.HashBd09.EqualIgnoreCase(hashBd09));
@@ -169,7 +169,7 @@ public static IList FindAllByHashBd09(String hashBd09)
/// 实体列表
public static IList FindAllByHashGcj02(String hashGcj02)
{
- if (hashGcj02.IsNullOrEmpty()) return new List();
+ if (hashGcj02.IsNullOrEmpty()) return [];
// 实体缓存
if (Meta.Session.Count < 1000) return Meta.Cache.FindAll(e => e.HashGcj02.EqualIgnoreCase(hashGcj02));
diff --git "a/MapApi/Locations/\345\234\260\347\220\206\346\225\260\346\215\2569\344\275\215.Biz.cs" "b/MapApi/Locations/\345\234\260\347\220\206\346\225\260\346\215\2569\344\275\215.Biz.cs"
index 1791fe3..5f04998 100644
--- "a/MapApi/Locations/\345\234\260\347\220\206\346\225\260\346\215\2569\344\275\215.Biz.cs"
+++ "b/MapApi/Locations/\345\234\260\347\220\206\346\225\260\346\215\2569\344\275\215.Biz.cs"
@@ -143,7 +143,7 @@ public static IList FindAllByCode(Int32 code)
/// 实体列表
public static IList FindAllByHash(String hash)
{
- if (hash.IsNullOrEmpty()) return new List();
+ if (hash.IsNullOrEmpty()) return [];
// 实体缓存
if (Meta.Session.Count < 1000) return Meta.Cache.FindAll(e => e.Hash.EqualIgnoreCase(hash));
@@ -156,7 +156,7 @@ public static IList FindAllByHash(String hash)
/// 实体列表
public static IList FindAllByHashBd09(String hashBd09)
{
- if (hashBd09.IsNullOrEmpty()) return new List();
+ if (hashBd09.IsNullOrEmpty()) return [];
// 实体缓存
if (Meta.Session.Count < 1000) return Meta.Cache.FindAll(e => e.HashBd09.EqualIgnoreCase(hashBd09));
@@ -169,7 +169,7 @@ public static IList FindAllByHashBd09(String hashBd09)
/// 实体列表
public static IList FindAllByHashGcj02(String hashGcj02)
{
- if (hashGcj02.IsNullOrEmpty()) return new List();
+ if (hashGcj02.IsNullOrEmpty()) return [];
// 实体缓存
if (Meta.Session.Count < 1000) return Meta.Cache.FindAll(e => e.HashGcj02.EqualIgnoreCase(hashGcj02));
diff --git a/NewLife.Map/AMap.cs b/NewLife.Map/AMap.cs
index 66f5475..8a98fba 100644
--- a/NewLife.Map/AMap.cs
+++ b/NewLife.Map/AMap.cs
@@ -43,7 +43,7 @@ public AMap()
/// 目标Url
/// 结果字段
///
- protected override async Task InvokeAsync(String url, String result)
+ protected override async Task InvokeAsync(String url, String? result)
{
var dic = await base.InvokeAsync>(url, result);
if (dic == null || dic.Count == 0) return default;
@@ -54,7 +54,7 @@ protected override async Task InvokeAsync(String url, String result)
var msg = dic["info"] + "";
// 删除无效密钥
- if (IsValidKey(msg)) RemoveKey(LastKey, DateTime.Now.AddHours(1));
+ if (!LastKey.IsNullOrEmpty() && IsValidKey(msg)) RemoveKey(LastKey, DateTime.Now.AddHours(1));
return !ThrowException ? default : throw new Exception(msg);
}
@@ -71,7 +71,7 @@ protected override async Task InvokeAsync(String url, String result)
///
///
///
- protected async Task> GetGeocoderAsync(String address, String city = null, String coordtype = null)
+ protected async Task?> GetGeocoderAsync(String address, String? city = null, String? coordtype = null)
{
if (address.IsNullOrEmpty()) throw new ArgumentNullException(nameof(address));
@@ -91,21 +91,16 @@ protected async Task> GetGeocoderAsync(String addres
///
/// 是否格式化地址。高德地图默认已经格式化地址
///
- public async Task GetGeoAsync(String address, String city = null, String coordtype = null, Boolean formatAddress = false)
+ public async Task GetGeoAsync(String address, String? city = null, String? coordtype = null, Boolean formatAddress = false)
{
var rs = await GetGeocoderAsync(address, city);
if (rs == null || rs.Count == 0) return null;
- var gp = new GeoPoint();
-
- var ds = (rs["location"] + "").Split(',');
- if (ds != null && ds.Length >= 2)
+ var geo = new GeoAddress
{
- gp.Longitude = ds[0].ToDouble();
- gp.Latitude = ds[1].ToDouble();
- }
+ Location = new(rs["location"] as String)
+ };
- var geo = new GeoAddress();
var reader = new JsonReader();
reader.ToObject(rs, null, geo);
@@ -114,11 +109,9 @@ public async Task GetGeoAsync(String address, String city = null, St
if (rs["township"] is IList