/// <summary> /// 获取树形展示数据 /// </summary> /// <returns></returns> public ActionResult GetJsTreeJson(bool update = false) { #region 使用MemoryCache缓存提高速度 System.Reflection.MethodBase method = System.Reflection.MethodBase.GetCurrentMethod(); string key = string.Format("{0}-{1}-{2}", method.DeclaringType.FullName, method.Name, ""); if (update) { MemoryCacheHelper.RemoveItem(key); } var result = MemoryCacheHelper.GetCacheItem <ActionResult>(key, delegate() { List <JsTreeData> treeList = new List <JsTreeData>(); List <DictTypeInfo> typeList = BLLFactory <DictType> .Instance.Find("PID='-1' "); foreach (DictTypeInfo info in typeList) { JsTreeData node = new JsTreeData(info.ID, info.Name, "fa fa-file icon-state-warning icon-lg"); GetJsTreeJson(info.ID, node); treeList.Add(node); } return(ToJsonContent(treeList)); }, new TimeSpan(0, 30, 0));//30分钟过期 return(result); #endregion }