|
|
@@ -46,6 +46,9 @@ namespace Learun.Application.Web.Controllers |
|
|
|
WeChatDevelopIBLL weChatDevelopIbll = new WeChatDevelopBLL(); |
|
|
|
private Sys_DefaultPwdConfigIBLL sys_DefaultPwdConfigIBLL = new Sys_DefaultPwdConfigBLL(); |
|
|
|
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 |
|
|
|
private readonly ISms _aliyunSms = new AliyunSms(); |
|
|
|
CacheByRedis _redis = new CacheByRedis(); |
|
|
@@ -1187,6 +1190,64 @@ namespace Learun.Application.Web.Controllers |
|
|
|
} |
|
|
|
#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> |
|
|
|