public IActionResult GetPages(PageParm parm) { parm.site = SiteTool.CurrentSite?.Guid; var res = _articleService.GetList(parm); return(Ok(new { code = 0, msg = "success", count = res.TotalItems, data = res.Items })); }
public void OnGet(string type) { //获得站点信息 if (_cacheService.Exists(CacheKey.WEBCMSSITE)) { Site = _cacheService.GetCache <CmsSite>(CacheKey.WEBCMSSITE); } else { Site = _siteService.GetModelAsync(m => m.Guid == "78756a6c-50c8-47a5-b898-5d6d24a20327").Result.data; //加入到缓存 _cacheService.SetCache(CacheKey.WEBCMSSITE, Site, DateTimeOffset.Now.AddDays(30)); } //获得栏目信息 if (_cacheService.Exists(CacheKey.WEBCMSCOLUMN)) { Column = _cacheService.GetCache <List <CmsColumn> >(CacheKey.WEBCMSCOLUMN); } else { Column = _columnService.GetListAsync(m => true, m => m.Sort, DbOrderEnum.Asc).Result.data; //加入到缓存 _cacheService.SetCache(CacheKey.WEBCMSCOLUMN, Column, DateTimeOffset.Now.AddDays(30)); } int page = 1; var listPage = Request.Query["page"]; if (!string.IsNullOrEmpty(listPage)) { page = Convert.ToInt32(listPage); } if (!string.IsNullOrEmpty(type)) { ActiveColumn = Column.Find(m => m.EnTitle == type); Page = _articleService.GetList(new Service.DtoModel.PageParm() { page = page, limit = 12, types = 1, id = ActiveColumn.Id }); Case = Page.Items; } else { ActiveColumn = new CmsColumn() { Id = 0, Title = "飞易腾案例" }; ActiveColumn.Id = 0; var caseColumn = Column.Where(m => m.ParentId == 1015).Select(m => m.Id).ToList(); Page = _articleService.WebGetList(new Service.DtoModel.PageParm() { page = page, limit = 12, types = 1 }, caseColumn); Case = Page.Items; } }
public JsonResult GetPages(PageParm parm) { var res = _articleService.GetList(parm); return(Json(new { code = 0, msg = "success", count = res.TotalItems, data = res.Items })); }