Bläddra i källkod

省市区数据导入

新疆警官学校中职
dao 1 månad sedan
förälder
incheckning
d50520d608
3 ändrade filer med 14861 tillägg och 1 borttagningar
  1. +61
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/LoginController.cs
  2. +3
    -1
      Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj
  3. +14797
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/ChinaCitys.json

+ 61
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/LoginController.cs Visa fil

@@ -46,6 +46,9 @@ namespace Learun.Application.Web.Controllers
WeChatDevelopIBLL weChatDevelopIbll = new WeChatDevelopBLL(); WeChatDevelopIBLL weChatDevelopIbll = new WeChatDevelopBLL();
private Sys_DefaultPwdConfigIBLL sys_DefaultPwdConfigIBLL = new Sys_DefaultPwdConfigBLL(); private Sys_DefaultPwdConfigIBLL sys_DefaultPwdConfigIBLL = new Sys_DefaultPwdConfigBLL();
private VisitorInfoIBLL visitorInfoIBLL = new VisitorInfoBLL(); private VisitorInfoIBLL visitorInfoIBLL = new VisitorInfoBLL();
private DIC_PROVINCEIBLL dicPro=new DIC_PROVINCEBLL();
private DIC_CITYIBLL dicCity=new DIC_CITYBLL();
private DIC_AREAIBLL dicArea=new DIC_AREABLL();
#endregion #endregion
private readonly ISms _aliyunSms = new AliyunSms(); private readonly ISms _aliyunSms = new AliyunSms();
CacheByRedis _redis = new CacheByRedis(); CacheByRedis _redis = new CacheByRedis();
@@ -1187,6 +1190,64 @@ namespace Learun.Application.Web.Controllers
} }
#endregion #endregion


#region
public ActionResult SyncProData()
{
// 读取JSON文件内容
string json = System.IO.File.ReadAllText(Server.MapPath("/XmlConfig/ChinaCitys.json")); //File.ReadAllText("data.json");

// 反序列化JSON到C#对象
var pro = JsonConvert.DeserializeObject<List<Province>>(json);
if (pro.Any())
{
foreach (var province in pro)
{
var prov = new DIC_PROVINCEEntity { PCODE = province.code, PNAME = province.province };
dicPro.SaveEntity("", prov);
if(province.citys.Any())
{
foreach (var item in province.citys)
{
var city = new DIC_CITYEntity { CCODE = item.code.Substring(0,6), CNAME = item.city, CPARENT = province.code };
dicCity.SaveEntity("", city);
if(item.areas.Any())
{
foreach(var area in item.areas)
{
var ar = new DIC_AREAEntity { ACODE = area.code.Substring(0, 6), ANAME = area.area, APARENT = item.code.Substring(0, 6) };
dicArea.SaveEntity("", ar);
}
}
}
}
}
}

return Content(json);
}
private class Province
{
public string province { get; set; }

public string code { get; set; }
public List<City> citys { get; set; }
}
private class City
{
public string city { get; set; }

public string code { get; set; }
public List<Area> areas { get; set; }
}
private class Area
{
public string area { get; set; }

public string code { get; set; }
}
#endregion

/// <summary> /// <summary>
/// 访客注册 /// 访客注册
/// </summary> /// </summary>


+ 3
- 1
Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj Visa fil

@@ -23,7 +23,8 @@
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\..\</SolutionDir> <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\..\</SolutionDir>
<RestorePackages>true</RestorePackages> <RestorePackages>true</RestorePackages>
<UseGlobalApplicationHostFile /> <UseGlobalApplicationHostFile />
<Use64BitIISExpress>false</Use64BitIISExpress>
<Use64BitIISExpress>
</Use64BitIISExpress>
<SccProjectName> <SccProjectName>
</SccProjectName> </SccProjectName>
<SccLocalPath> <SccLocalPath>
@@ -7107,6 +7108,7 @@
<Content Include="Areas\EducationalAdministration\Views\HistoryStuScore\Index.js" /> <Content Include="Areas\EducationalAdministration\Views\HistoryStuScore\Index.js" />
<Content Include="Areas\EducationalAdministration\Views\HistoryStuScore\Form.cshtml" /> <Content Include="Areas\EducationalAdministration\Views\HistoryStuScore\Form.cshtml" />
<Content Include="Areas\EducationalAdministration\Views\HistoryStuScore\Form.js" /> <Content Include="Areas\EducationalAdministration\Views\HistoryStuScore\Form.js" />
<Content Include="XmlConfig\ChinaCitys.json" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Areas\EducationalAdministration\Views\OpenLessonPlanOfElectivePre\" /> <Folder Include="Areas\EducationalAdministration\Views\OpenLessonPlanOfElectivePre\" />


+ 14797
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/ChinaCitys.json
Filskillnaden har hållits tillbaka eftersom den är för stor
Visa fil


Laddar…
Avbryt
Spara