/// <summary> /// 获取城市 /// </summary> /// <param name="userInfo">用户</param> /// <param name="province">省份</param> /// <returns>城市数组</returns> public string[] GetCity(BaseUserInfo userInfo, string province) { string[] result = null; #if Redis result = BaseOrganizeManager.GetCityByCache(province); #else var parameter = ServiceInfo.Create(userInfo, MethodBase.GetCurrentMethod()); ServiceUtil.ProcessUserCenterReadDb(userInfo, parameter, (dbHelper) => { System.Web.Caching.Cache cache = HttpRuntime.Cache; string cacheObject = "AreaOrganizeCity" + province; if (cache != null && cache[cacheObject] == null) { // BaseAreaManager areaManager = new BaseAreaManager(dbHelper, result); // result = areaManager.GetCityList(provinceId); var manager = new BaseOrganizeManager(dbHelper, userInfo); result = manager.GetCity(province); cache.Add(cacheObject, result, null, DateTime.Now.AddHours(8), TimeSpan.Zero, CacheItemPriority.Normal, null); } result = cache[cacheObject] as string[]; }); #endif return(result); }