|
@@ -145,11 +145,11 @@ public class SysRegionService : IDynamicApiController, ITransient
|
|
|
{
|
|
{
|
|
|
var syncLevel = await _sysConfigService.GetConfigValue<int>(ConfigConst.SysRegionSyncLevel);
|
|
var syncLevel = await _sysConfigService.GetConfigValue<int>(ConfigConst.SysRegionSyncLevel);
|
|
|
if (syncLevel is < 1 or > 5) syncLevel = 3;//默认区县级
|
|
if (syncLevel is < 1 or > 5) syncLevel = 3;//默认区县级
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
await _sysRegionRep.DeleteAsync(u => u.Id > 0);
|
|
await _sysRegionRep.DeleteAsync(u => u.Id > 0);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
await SyncByMap(syncLevel);
|
|
await SyncByMap(syncLevel);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// var context = BrowsingContext.New(AngleSharp.Configuration.Default.WithDefaultLoader());
|
|
// var context = BrowsingContext.New(AngleSharp.Configuration.Default.WithDefaultLoader());
|
|
|
// var dom = await context.OpenAsync(_url);
|
|
// var dom = await context.OpenAsync(_url);
|
|
|
//
|
|
//
|
|
@@ -265,7 +265,7 @@ public class SysRegionService : IDynamicApiController, ITransient
|
|
|
// await _sysRegionRep.Context.Fastest<SysRegion>().BulkCopyAsync(list);
|
|
// await _sysRegionRep.Context.Fastest<SysRegion>().BulkCopyAsync(list);
|
|
|
// }
|
|
// }
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// 从统计局地图页面同步
|
|
/// 从统计局地图页面同步
|
|
|
/// </summary>
|
|
/// </summary>
|
|
@@ -291,11 +291,11 @@ public class SysRegionService : IDynamicApiController, ITransient
|
|
|
Level = 1,
|
|
Level = 1,
|
|
|
Pid = 0,
|
|
Pid = 0,
|
|
|
};
|
|
};
|
|
|
- if (municipalityList.Any(m => province.Name.StartsWith(m))) province.Name += "(省)";
|
|
|
|
|
|
|
+ if (municipalityList.Any(m => province.Name.StartsWith(m))) province.Name += "(省)";
|
|
|
list.Add(province);
|
|
list.Add(province);
|
|
|
|
|
|
|
|
if (syncLevel <= 1) continue;
|
|
if (syncLevel <= 1) continue;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
var prefList = await GetSelectList(provName);
|
|
var prefList = await GetSelectList(provName);
|
|
|
foreach (var dict2 in prefList)
|
|
foreach (var dict2 in prefList)
|
|
|
{
|
|
{
|
|
@@ -309,11 +309,11 @@ public class SysRegionService : IDynamicApiController, ITransient
|
|
|
Name = prefName,
|
|
Name = prefName,
|
|
|
Level = 2
|
|
Level = 2
|
|
|
};
|
|
};
|
|
|
- if (municipalityList.Any(m => city.Name.StartsWith(m))) city.Name += "(地)";
|
|
|
|
|
|
|
+ if (municipalityList.Any(m => city.Name.StartsWith(m))) city.Name += "(地)";
|
|
|
list.Add(city);
|
|
list.Add(city);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if (syncLevel <= 2) continue;
|
|
if (syncLevel <= 2) continue;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
var countyList = await GetSelectList(provName, prefName);
|
|
var countyList = await GetSelectList(provName, prefName);
|
|
|
foreach (var dict3 in countyList)
|
|
foreach (var dict3 in countyList)
|
|
|
{
|
|
{
|
|
@@ -335,7 +335,7 @@ public class SysRegionService : IDynamicApiController, ITransient
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 获取选择数据
|
|
// 获取选择数据
|
|
|
- async Task<List<Dictionary<string, string>>> GetSelectList(string prov, string prefecture=null)
|
|
|
|
|
|
|
+ async Task<List<Dictionary<string, string>>> GetSelectList(string prov, string prefecture = null)
|
|
|
{
|
|
{
|
|
|
var data = "";
|
|
var data = "";
|
|
|
if (!string.IsNullOrWhiteSpace(prov)) data += $"shengji={prov}";
|
|
if (!string.IsNullOrWhiteSpace(prov)) data += $"shengji={prov}";
|