333
This commit is contained in:
parent
f454ae0417
commit
f695fbbdc6
|
|
@ -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 ?? "";
|
||||
}
|
||||
|
|
|
|||
BIN
ZR.Admin.WebApi/gift/2025/0807/1754569878_7326.jpg
Normal file
BIN
ZR.Admin.WebApi/gift/2025/0807/1754569878_7326.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 105 KiB |
BIN
ZR.Admin.WebApi/gift/2025/0807/1754569913_7214.jpg
Normal file
BIN
ZR.Admin.WebApi/gift/2025/0807/1754569913_7214.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 105 KiB |
BIN
ZR.Admin.WebApi/gift/2025/0807/1754569925_2040.jpg
Normal file
BIN
ZR.Admin.WebApi/gift/2025/0807/1754569925_2040.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 105 KiB |
BIN
ZR.Admin.WebApi/gift/2025/0807/1754570095_2396.jpg
Normal file
BIN
ZR.Admin.WebApi/gift/2025/0807/1754570095_2396.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 105 KiB |
BIN
ZR.Admin.WebApi/gift/2025/0807/1754570111_2513.jpg
Normal file
BIN
ZR.Admin.WebApi/gift/2025/0807/1754570111_2513.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 105 KiB |
|
|
@ -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<ReGeoCodeResult>(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("", "");
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user