public JsonResult GetFootNew() { //页脚 var articleCategoryService = _iArticleCategoryService; var articleService = _iArticleService; //服务文章 var pageFootServiceCategory = articleCategoryService.GetSpecialArticleCategory(SpecialCategory.PageFootService); if (pageFootServiceCategory == null) { return(Json(null)); } var pageFootServiceSubCategies = articleCategoryService.GetArticleCategoriesByParentId(pageFootServiceCategory.Id).ToList(); dynamic noticeInfo = new System.Dynamic.ExpandoObject(); var allArticle = articleService.GetArticleByArticleCategoryIds(pageFootServiceSubCategies.Select(a => a.Id).ToList()).Where(p => p.IsRelease).ToList(); FootNoticeModel info = null; List <FootNoticeModel> resultList = new List <FootNoticeModel>(); pageFootServiceSubCategies.ForEach(p => { info = new FootNoticeModel() { CateogryName = p.Name, List = allArticle.Where(x => x.CategoryId == p.Id).Select(y => new ArticleInfo { Id = y.Id, Title = y.Title }).ToList() }; resultList.Add(info); }); noticeInfo.PageFootService = resultList; //页脚 noticeInfo.PageFoot = SiteSettings.PageFoot; noticeInfo.QRCode = SiteSettings.QRCode; noticeInfo.SiteName = SiteSettings.SiteName; noticeInfo.Logo = SiteSettings.Logo; noticeInfo.PCBottomPic = SiteSettings.PCBottomPic; noticeInfo.Site_SEOTitle = SiteSettings.Site_SEOTitle; noticeInfo.APPCanDownload = SiteSettings.CanDownload; if (SiteSettings.CanDownload) { string host = CurrentUrlHelper.CurrentUrlNoPort(); var link = String.Format("{0}/m-wap/home/downloadApp", host); var map = Core.Helper.QRCodeHelper.Create(link); MemoryStream ms = new MemoryStream(); map.Save(ms, System.Drawing.Imaging.ImageFormat.Gif); // 将图片内存流转成base64,图片以DataURI形式显示 string strUrl = "data:image/gif;base64," + Convert.ToBase64String(ms.ToArray()); ms.Dispose(); noticeInfo.appqr = strUrl; } return(Json(noticeInfo, true)); }
//[OutputCache(Duration = ConstValues.PAGE_CACHE_DURATION)] public ActionResult Foot() { //页脚 var articleCategoryService = _iArticleCategoryService; var articleService = _iArticleService; //服务文章 var pageFootServiceCategory = articleCategoryService.GetSpecialArticleCategory(SpecialCategory.PageFootService); if (pageFootServiceCategory == null) { return(PartialView("~/Areas/Web/Views/Shared/Foot.cshtml")); } var pageFootServiceSubCategies = articleCategoryService.GetArticleCategoriesByParentId(pageFootServiceCategory.Id).ToList(); dynamic noticeInfo = new System.Dynamic.ExpandoObject(); var allArticle = articleService.GetArticleByArticleCategoryIds(pageFootServiceSubCategies.Select(a => a.Id).ToList()).Where(p => p.IsRelease).ToList(); FootNoticeModel info = null; List <FootNoticeModel> resultList = new List <FootNoticeModel>(); pageFootServiceSubCategies.ForEach(p => { info = new FootNoticeModel() { CateogryName = p.Name, List = allArticle.Where(x => x.CategoryId == p.Id).Select(y => new ArticleInfo { Id = y.Id, Title = y.Title }).ToList() }; resultList.Add(info); }); ViewBag.PageFootService = resultList; //页脚 ViewBag.PageFoot = SiteSettings.PageFoot; ViewBag.QRCode = SiteSettings.QRCode; ViewBag.SiteName = SiteSettings.SiteName; //string html = System.IO.File.ReadAllText(this.Server.MapPath(_templateFootHtmlFileFullName));//读取模板尾部html静态文件内容 //ViewBag.Html = html; return(PartialView("~/Areas/Web/Views/Shared/Foot.cshtml")); }