private async Task <IActionResult> RenderInfo(Site site, Column column, ModelTable model, ContentData item) { string folderName = site.IsMobileSite ? site.MobileSiteFolder : site.SiteFolder; string templatePath = $"Views/Content/{folderName}/{column.InfoTemplatePath}"; if (!System.IO.File.Exists(Path.GetFullPath(templatePath))) { return(Error404()); } var seo = new ContentSeo(column); var info = new ContentInfo(); if (item != null) { int clickCount = item.ClickCount; int id = item.Id; info.Column = column; info.Site = site; info.ModelTable = model; info.Data = item; info.NextData = await _contentService.GetNext(model.SqlTableName, column.Num, id); info.PrevData = await _contentService.GetPrev(model.SqlTableName, column.Num, id); seo.Title = item.SeoTitle; seo.Keyword = item.SeoKeyword; seo.Desc = item.SeoDesc; await _contentService.UpdateClickCount(model.SqlTableName, id, clickCount + 1); } ViewData.Model = info; ViewBag.Seo = seo; ViewBag.Site = site; return(View($"~/{templatePath}")); }
public async Task <IActionResult> Tag(string num, string tag, int current = 1) { if (num.IsEmpty() || tag.IsEmpty()) { return(Error404()); } var site = _siteService.GetCurrentSite(); if (site == null) { return(Error404()); } var column = await _columnService.GetByNum(num); if (column == null || column.SiteNum != site.Num) { return(Error404()); } var model = column.ModelNum.IsEmpty() ? null : await _modelTableService.GetByNum(column.ModelNum); string folderName = site.IsMobileSite ? site.MobileSiteFolder : site.SiteFolder; string templatePath = $"Views/Content/{folderName}/{column.ListTemplatePath}"; if (!System.IO.File.Exists(Path.GetFullPath(templatePath))) { return(Error404()); } int size = 15; switch (column.Num) { case "9a32d00252853c5e": size = 3; break; } var req = new SqlServerPageRequest { Current = current, Size = size, Queries = new List <IQuery> { new DefaultQuery(column.Num, new DefaultQuerySql("columnNum")), new DefaultQuery(false, new DefaultQuerySql("IsDel")), new DefaultQuery($"&|&|&{tag}&|&|&", new DefaultQuerySql("CONCAT('&|&|&', Tag, '&|&|&')", QuerySymbol.Like)) } }; var seo = new ContentSeo(column); if (model != null) { var rep = await _contentService.Page(model.SqlTableName, req); ViewData.Model = new ContentList { Column = column, ModelTable = model, Site = site, Data = rep.Data.Select(temp => new ContentData(temp)), PageConfig = new PageConfig { Current = req.Current, Size = req.Size, Total = rep.Total, UrlTemplate = "/tag/" + column.Num + "/" + tag + "/{p}" } }; } ViewBag.Seo = seo; ViewBag.Site = site; ViewBag.Tag = tag; return(View($"~/{templatePath}")); }