/// <summary> /// 分页获取通知公告 /// </summary> /// <param name="pageIndex">页数</param> /// <param name="pageSize">页码</param> /// <returns></returns> public async Task <PageDTO <AnnouncementDTO> > GetAnnouncementAsyncByPage(int pageIndex, int pageSize) { return(await Task.Run(() => { var announcements = AnnouncementRepository.GetModelsByPage(pageSize, pageIndex, true, a => a.createDate, a => a.endPushDate < DateTime.Now, out var total); var list = Mapper.Map <List <AnnouncementDTO> >(announcements.ToList()); return new PageDTO <AnnouncementDTO>(pageIndex, pageSize, total, list); })); }