😎优化行政区划代码
This commit is contained in:
parent
a9491ea08b
commit
f75abc9d4a
@ -17,9 +17,6 @@ public class SysRegionService : IDynamicApiController, ITransient
|
|||||||
private readonly SqlSugarRepository<SysRegion> _sysRegionRep;
|
private readonly SqlSugarRepository<SysRegion> _sysRegionRep;
|
||||||
private readonly SysConfigService _sysConfigService;
|
private readonly SysConfigService _sysConfigService;
|
||||||
|
|
||||||
// Url地址-高德
|
|
||||||
private readonly string _url = "https://restapi.amap.com/v3/config/district?subdistrict";
|
|
||||||
|
|
||||||
public SysRegionService(SqlSugarRepository<SysRegion> sysRegionRep, SysConfigService sysConfigService)
|
public SysRegionService(SqlSugarRepository<SysRegion> sysRegionRep, SysConfigService sysConfigService)
|
||||||
{
|
{
|
||||||
_sysRegionRep = sysRegionRep;
|
_sysRegionRep = sysRegionRep;
|
||||||
@ -177,7 +174,7 @@ public class SysRegionService : IDynamicApiController, ITransient
|
|||||||
if (syncLevel < 1 || syncLevel > 5)
|
if (syncLevel < 1 || syncLevel > 5)
|
||||||
syncLevel = 3; // 默认区县级
|
syncLevel = 3; // 默认区县级
|
||||||
|
|
||||||
var res = await $"{_url}{syncLevel}&key={key}".GetAsync();
|
var res = await $"https://restapi.amap.com/v3/config/district?subdistrict={syncLevel}&key={key}".GetAsync();
|
||||||
if (!res.IsSuccessStatusCode) return;
|
if (!res.IsSuccessStatusCode) return;
|
||||||
|
|
||||||
var gdResponse = JSON.Deserialize<GDResponse<List<GDRegionResponse>>>(res.Content.ReadAsStringAsync().Result);
|
var gdResponse = JSON.Deserialize<GDResponse<List<GDRegionResponse>>>(res.Content.ReadAsStringAsync().Result);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user