/// <summary> /// 获取文章列表 分类或最终的详情链接 /// </summary> /// <param name="context"></param> /// <returns></returns> private string GetArticleListV1(HttpContext context) { string host = string.Format("http://{0}", context.Request.Url.Authority); string cateId = context.Request["cateid"]; string name = context.Request["name"]; List <ArticleModel> list = new List <ArticleModel>(); List <ArticleCategory> subCategoryList = new List <ArticleCategory>();// 下级分类列表 subCategoryList = bll.GetList <ArticleCategory>(string.Format(" WebsiteOwner='{0}' And PreID={1}", bll.WebsiteOwner, cateId)); //先检查有没有下级分类 if (subCategoryList.Count > 0)//有下级分类输出下级分类列表 { foreach (var category in subCategoryList) { ArticleModel model = new ArticleModel(); model.ArticleTitle = category.CategoryName; model.ArticleThumbnails = "/web/defaultcategory.jpg"; model.ArticleContent = ""; model.ArticleUrl = string.Format("/web/list.aspx?cateid={0}", category.AutoID); list.Add(model); } } else { var sourceDataList = bll.GetArticleListV1(context.Request["cateid"], context.Request["name"]); sourceDataList = sourceDataList.Where(p => p.IsHide.Equals(0) && p.IsDelete.Equals(0)).ToList(); foreach (var source in sourceDataList) { ArticleModel model = new ArticleModel(); model.ArticleTitle = source.ActivityName; model.ArticleContent = source.Summary; model.ArticleThumbnails = bll.GetImgUrl(source.ThumbnailsPath); model.ArticleUrl = string.Format("{0}/{1}/details.chtml", host, source.JuActivityIDHex); list.Add(model); } } return(Common.JSONHelper.ObjectToJson(list)); }