diff --git a/ZR.Admin.WebApi/Controllers/WebApiController.cs b/ZR.Admin.WebApi/Controllers/WebApiController.cs index b1464f4..41e6a06 100644 --- a/ZR.Admin.WebApi/Controllers/WebApiController.cs +++ b/ZR.Admin.WebApi/Controllers/WebApiController.cs @@ -170,7 +170,7 @@ namespace ZR.Admin.WebApi.Controllers var (result, message) = resultTuple.Value; if (result != null) { - geocodedAddress = result.Regeocode.Formatted_Address; + geocodedAddress = result; } regeo = message ?? ""; } diff --git a/ZR.Admin.WebApi/gift/2025/0807/1754569878_7326.jpg b/ZR.Admin.WebApi/gift/2025/0807/1754569878_7326.jpg new file mode 100644 index 0000000..c0cd32d Binary files /dev/null and b/ZR.Admin.WebApi/gift/2025/0807/1754569878_7326.jpg differ diff --git a/ZR.Admin.WebApi/gift/2025/0807/1754569913_7214.jpg b/ZR.Admin.WebApi/gift/2025/0807/1754569913_7214.jpg new file mode 100644 index 0000000..c0cd32d Binary files /dev/null and b/ZR.Admin.WebApi/gift/2025/0807/1754569913_7214.jpg differ diff --git a/ZR.Admin.WebApi/gift/2025/0807/1754569925_2040.jpg b/ZR.Admin.WebApi/gift/2025/0807/1754569925_2040.jpg new file mode 100644 index 0000000..c0cd32d Binary files /dev/null and b/ZR.Admin.WebApi/gift/2025/0807/1754569925_2040.jpg differ diff --git a/ZR.Admin.WebApi/gift/2025/0807/1754570095_2396.jpg b/ZR.Admin.WebApi/gift/2025/0807/1754570095_2396.jpg new file mode 100644 index 0000000..c0cd32d Binary files /dev/null and b/ZR.Admin.WebApi/gift/2025/0807/1754570095_2396.jpg differ diff --git a/ZR.Admin.WebApi/gift/2025/0807/1754570111_2513.jpg b/ZR.Admin.WebApi/gift/2025/0807/1754570111_2513.jpg new file mode 100644 index 0000000..c0cd32d Binary files /dev/null and b/ZR.Admin.WebApi/gift/2025/0807/1754570111_2513.jpg differ diff --git a/ZR.Common/GeoCodeService.cs b/ZR.Common/GeoCodeService.cs index 7e778bb..af93469 100644 --- a/ZR.Common/GeoCodeService.cs +++ b/ZR.Common/GeoCodeService.cs @@ -20,7 +20,7 @@ public class GeoCodeService _httpClient = httpClient ?? throw new ArgumentNullException(nameof(httpClient)); } - public async Task<(ReGeoCodeResult, string)?> GetReGeoCodeAsync(string location, string coordsys = "gcj02") + public async Task<(string, string)?> GetReGeoCodeAsync(string location, string coordsys = "gcj02") { if (string.IsNullOrWhiteSpace(location)) { @@ -33,19 +33,22 @@ public class GeoCodeService { var response = await _httpClient.GetAsync(requestUrl); response.EnsureSuccessStatusCode(); - var content = await response.Content.ReadAsStringAsync(); + var json = JsonDocument.Parse(content); - var result = JsonConvert.DeserializeObject(content); - - return new(result, content); + // 直接提取 formatted_address + var j = json.RootElement + .GetProperty("regeocode") + .GetProperty("formatted_address") + .GetString(); + return new(j, content); } catch (HttpRequestException ex) { //throw new ApplicationException("Error calling AMap API", ex); } - return new(null, ""); + return new("", ""); } } ///