using Azylee.Core.DataUtils.CollectionUtils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Azylee.YeahWeb.BaiDuWebAPI.IPLocationAPI
{
class IPLocationWebModel
{
///
///
///
public IpLoc ipLoc { get; set; }
///
///
///
public Rgc rgc { get; set; }
public IPLocationModel ToIPLocationModel()
{
IPLocationModel model = null;
try
{
if (rgc != null)
{
model = new IPLocationModel();
model.FirstPOI = new FirstPOI();
model.Component = new Component();
if (rgc.result != null)
{
model.FormattedAddress = rgc.result.formatted_address;
model.Business = rgc.result.business;
model.SematicDescription = rgc.result.sematic_description;
if (rgc.result.location != null)
{
model.Latitude = rgc.result.location.lat;
model.Longitude = rgc.result.location.lng;
}
if (ListTool.HasElements(rgc.result.pois))
{
model.FirstPOI.Address = rgc.result.pois[0].addr;
model.FirstPOI.Name = rgc.result.pois[0].name;
}
if (rgc.result.addressComponent != null)
{
model.Component.Country = rgc.result.addressComponent.country;
model.Component.Province = rgc.result.addressComponent.province;
model.Component.City = rgc.result.addressComponent.city;
model.Component.District = rgc.result.addressComponent.district;
model.Component.Town = rgc.result.addressComponent.town;
model.Component.AdCode = rgc.result.addressComponent.adcode;
model.Component.Street = rgc.result.addressComponent.street;
model.Component.StreetNumber = rgc.result.addressComponent.street_number;
model.Component.Direction = rgc.result.addressComponent.direction;
model.Component.Distance = rgc.result.addressComponent.distance;
}
}
}
}
catch { }
return model;
}
public class IpLoc
{
///
///
///
public Content content { get; set; }
///
///
///
public IPResult result { get; set; }
///
///
///
public string status { get; set; }
///
///
///
public string message { get; set; }
///
///
///
public int code { get; set; }
///
///
///
public int time { get; set; }
}
public class Content
{
///
///
///
public IPLocation location { get; set; }
///
///
///
public string locid { get; set; }
///
///
///
public int radius { get; set; }
///
///
///
public double confidence { get; set; }
///
///
///
public int ip_type { get; set; }
///
///
///
public IPPoint point { get; set; }
}
public class IPResult
{
///
///
///
public int error { get; set; }
///
///
///
public string loc_time { get; set; }
}
public class IPLocation
{
///
///
///
public int lat { get; set; }
///
///
///
public int lng { get; set; }
}
public class IPPoint
{
///
///
///
public int x { get; set; }
///
///
///
public int y { get; set; }
}
public class Rgc
{
///
///
///
public string status { get; set; }
///
///
///
public Result result { get; set; }
///
///
///
public int code { get; set; }
///
///
///
public string message { get; set; }
///
///
///
public int time { get; set; }
}
public class Result
{
///
///
///
public Location location { get; set; }
///
/// 山东省青岛市城阳区
///
public string formatted_address { get; set; }
///
/// 棘洪滩
///
public string business { get; set; }
///
///
///
public AddressComponent addressComponent { get; set; }
///
///
///
public List pois { get; set; }
///
///
///
public List roads { get; set; }
///
///
///
public List poiRegions { get; set; }
///
/// 中车青岛四方机车车辆股份有限公司西北296米
///
public string sematic_description { get; set; }
///
///
///
public int cityCode { get; set; }
}
public class Location
{
///
///
///
public double lng { get; set; }
///
///
///
public double lat { get; set; }
}
public class AddressComponent
{
///
/// 中国
///
public string country { get; set; }
///
///
///
public int country_code { get; set; }
///
///
///
public string country_code_iso { get; set; }
///
///
///
public string country_code_iso2 { get; set; }
///
/// 山东省
///
public string province { get; set; }
///
/// 青岛市
///
public string city { get; set; }
///
///
///
public int city_level { get; set; }
///
/// 城阳区
///
public string district { get; set; }
///
///
///
public string town { get; set; }
///
///
///
public string adcode { get; set; }
///
///
///
public string street { get; set; }
///
///
///
public string street_number { get; set; }
///
///
///
public string direction { get; set; }
///
///
///
public string distance { get; set; }
}
public class Point
{
///
///
///
public double x { get; set; }
///
///
///
public double y { get; set; }
}
public class Parent_poi
{
///
///
///
public string name { get; set; }
///
///
///
public string tag { get; set; }
///
///
///
public string addr { get; set; }
///
///
///
public Point point { get; set; }
///
///
///
public string direction { get; set; }
///
///
///
public string distance { get; set; }
///
///
///
public string uid { get; set; }
}
public class PoisItem
{
///
/// 山东省青岛市城阳区棘洪滩街道锦宏东路88号
///
public string addr { get; set; }
///
///
///
public string cp { get; set; }
///
/// 西北
///
public string direction { get; set; }
///
///
///
public string distance { get; set; }
///
/// 中车青岛四方机车车辆股份有限公司
///
public string name { get; set; }
///
/// 公司企业
///
public string poiType { get; set; }
///
///
///
public Point point { get; set; }
///
/// 公司企业;公司
///
public string tag { get; set; }
///
///
///
public string tel { get; set; }
///
///
///
public string uid { get; set; }
///
///
///
public string zip { get; set; }
///
///
///
public Parent_poi parent_poi { get; set; }
}
public class PoiRegionsItem
{
///
/// 内
///
public string direction_desc { get; set; }
///
/// 中车青岛四方机车车辆股份有限公司
///
public string name { get; set; }
///
/// 公司企业;公司
///
public string tag { get; set; }
///
///
///
public string uid { get; set; }
}
}
}