public List <CategoryModel> GetCategoryList() { var allInfo = CategoryFacade.QueryCategoryInfosForHomePage(); List <CategoryModel> result = new List <CategoryModel>(); ClientType clientType = HeaderHelper.GetClientType(); string subFoler = "h"; if (clientType == ClientType.Android) { if (HeaderHelper.IsAndroidXHigh()) { subFoler = "xh"; } } else { subFoler = "ios"; } string baseUrl = ""; MobileAppConfig config = AppSettings.GetCachedConfig(); if (config != null && config.MobileAppServiceHost != null) { config.MobileAppServiceHost = config.MobileAppServiceHost.Trim(); if (!config.MobileAppServiceHost.EndsWith("/")) { config.MobileAppServiceHost += "/"; } baseUrl = config.MobileAppServiceHost; } foreach (var c1 in allInfo) { var m1 = Transform(c1); //获取一级分类图标 m1.ICon = BuildCatIcon(baseUrl, "c1", subFoler, c1.CategoryID.ToString(), "png");//CatHelper.GetIcon(c1.CategoryID); result.Add(m1); foreach (var c2 in c1.SubCategories) { var m2 = Transform(c2); //获取二级分类图标 m2.ICon = BuildCatIcon(baseUrl, "c2", subFoler, c2.CategoryID.ToString(), "jpg");//CatHelper.GetSubIcon(c1.CategoryID, c2.CategoryID); m1.SubCategories.Add(m2); foreach (var c3 in c2.SubCategories) { var m3 = Transform(c3); m2.SubCategories.Add(m3); } } } return(result); }