using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; namespace GuangFu.StringTracing.Common { public class Public { #region 递归收集所有城市(主城市 + 子城市) public static void CollectAllCities( IReadOnlyList cities, List result) { if (cities == null) return; foreach (var city in cities) { result.Add(city); if (city.ChildCities != null && city.ChildCities.Count > 0) CollectAllCities(city.ChildCities, result); } } #endregion #region 递归收集所有城市(主城市 + 子城市) public static void CollectInternationalCities( IReadOnlyList cities, List result) { if (cities == null) return; foreach (var city in cities) { result.Add(city); } } #endregion } #region 自定义参数 #region 分贝通国内城市 public class FenbeitongCity { public string Id { get; set; } public string Name { get; set; } public int Type { get; set; } public List ChildCities { get; set; } } public class ApiResponse { public string trace_id { get; set; } public int code { get; set; } public string msg { get; set; } public DataContainer data { get; set; } public string request_id { get; set; } } public class DataContainer { public List cities { get; set; } } #endregion #region 分贝通国际城市 public class InternationalCity { public string id { get; set; } public string name { get; set; } public string en_name { get; set; } } public class InternationalResponse { public string trace_id { get; set; } public int code { get; set; } public string msg { get; set; } public InternationalData data { get; set; } public string request_id { get; set; } } public class InternationalData { public List countries { get; set; } } #endregion #region 携程国际国家 public class XCCountry { public string responseCode { get; set; } public string responseDesc { get; set; } public List countryList { get; set; } } public class CountryList { public string countryId { get; set; } public string name { get; set; } public string enName { get; set; } public string code { get; set; } public string continentId { get; set; } } #endregion #region 携程国内城市 public class CountyList { /// /// /// public int countyId { get; set; } /// /// 酉阳 /// public string countyName { get; set; } /// /// /// public string countyEnName { get; set; } /// /// /// public string countyCode { get; set; } /// /// /// public string countyPinyin { get; set; } /// /// /// public int corpTag { get; set; } /// /// /// public string districtCode { get; set; } } public class PrefectureLevelCityInfoList { /// /// /// public int cityId { get; set; } /// /// 重庆 /// public string cityName { get; set; } /// /// /// public string cityEnName { get; set; } /// /// /// public string cityCode { get; set; } /// /// /// public string cityPinYin { get; set; } /// /// /// public int corpTag { get; set; } /// /// /// public string districtCode { get; set; } /// /// /// public List countyList { get; set; } } public class DataList { /// /// /// public int provinceId { get; set; } /// /// 重庆 /// public string provinceName { get; set; } /// /// /// public string provinceEnName { get; set; } /// /// /// public List prefectureLevelCityInfoList { get; set; } } public class XCChinaCity { /// /// /// public List dataList { get; set; } } #endregion #endregion }