public virtual void AfterPostAdd( int postId ) { ContentPost post = ContentPost.findById( postId ); // 3)相关列表页也要更新 HtmlMaker.GetList().Process( post ); logger.Info( "[AfterPostAdd] make html list done. postId=" + postId ); // 4) 最近列表页处理 HtmlMaker.GetRecent().ProcessAll( post.AppId ); logger.Info( "[AfterPostAdd] make html recent done. postId=" + postId ); }
private static void refreshAttachmentCount(ContentAttachment at) { ContentPost post = ContentPost.findById(at.PostId); if (post == null) { return; } int count = ContentAttachment.count("PostId=" + post.Id); post.Attachments = count; post.update(); }
public virtual void Restore(int id) { ContentPost post = ContentPost.findById(id); if (post == null) { return; } post.SaveStatus = SaveStatus.Normal; post.update(); ContentPostSection.updateBatch("SaveStatus=" + SaveStatus.Normal, "PostId=" + post.Id); }
public virtual void AfterPostUpdate(int postId) { ContentPost post = ContentPost.findById(postId); // 3) 列表页处理 HtmlMaker.GetList().Process(post); logger.Info("[AfterPostUpdate] make html list done. postId=" + postId); // 4) 最近列表页处理 HtmlMaker.GetRecent().ProcessAll(post.AppId); logger.Info("[AfterPostUpdate] make html recent done. postId=" + postId); // 5) 侧边栏 HtmlMaker.GetSidebar().Process(post.AppId); logger.Info("[AfterPostUpdate] make html sidebar done. postId=" + postId); }
public virtual String GetSectionIdsByPost(int postId) { List <ContentPostSection> list = ContentPostSection.find("PostId=" + postId).list(); if (list.Count == 0) { ContentPost post = ContentPost.findById(postId); return(post == null ? "" : post.PageSection.Id.ToString()); } String ids = ""; foreach (ContentPostSection ps in list) { ids += ps.Section.Id + ","; } return(ids.TrimEnd(',')); }
public ContentPost GetById_ForAdmin(int id) { return(ContentPost.findById(id)); }
public virtual void AfterImport(String ids) { if (strUtil.IsNullOrEmpty(ids)) { return; } int[] arrIds = cvt.ToIntArray(ids); if (arrIds.Length == 0) { return; } List <int> appIds = new List <int>(); List <int> sectionIds = new List <int>(); List <ContentPost> posts = new List <ContentPost>(); // 1) 逐一生成详细页 foreach (int id in arrIds) { ContentPost x = ContentPost.findById(id); if (x == null) { continue; } posts.Add(x); if (isAutoMakeHtml(x.AppId) == false) { continue; } if (appIds.Contains(x.AppId) == false) { appIds.Add(x.AppId); } if (sectionIds.Contains(x.SectionId) == false) { sectionIds.Add(x.SectionId); } HtmlMaker.GetDetail().Process(x); logger.Info("[AfterImport] make html detail done. postId=" + x); } // 2) 列表页 foreach (int x in sectionIds) { HtmlMaker.GetList().ProcessSection(x); logger.Info("[AfterImport] make html list done. sectionId=" + x); } foreach (int appId in appIds) { // 3) 生成首页 HtmlMaker.GetHome().Process(appId); logger.Info("[AfterImport] make html home done. appId=" + appId); // 4) 生成侧边栏 HtmlMaker.GetSidebar().Process(appId); logger.Info("[AfterImport] make html sidebar done. appId=" + appId); // 5) 最近列表页处理 HtmlMaker.GetRecent().ProcessAll(appId); logger.Info("[AfterImport] make html recent done. appId=" + appId); } }
public virtual ContentPost GetById_ForAdmin(long id) { return(ContentPost.findById(id)); }