public override void AfterAction(MvcContext ctx) { if (!HtmlHelper.CanHtml(ctx)) { return; } // 1)文章添加之后,app首页和侧边栏都要更新 HtmlMaker.GetHome().Process(ctx.app.Id); logger.Info("PostAddObserver make app home"); // 2)新创建的文章,需要通过 ctx 传递 ContentPost post = HtmlHelper.GetPostFromContext(ctx); if (post != null) { DetailMaker mk = HtmlMaker.GetDetail(); mk.Process(post); ContentPost prev = postService.GetPrevPost(post); if (prev != null) { mk.Process(prev); } } // 3) 侧边栏 HtmlMaker.GetSidebar().Process(post.AppId); // 4) 其他生成工作放到队列中 JobManager.PostAdd(post); }
public override void AfterAction(MvcContext ctx) { if (!HtmlHelper.CanHtml(ctx)) { return; } HtmlMaker.GetHome().Process(ctx.app.Id); logger.Info("HomeObserver make app home"); }
public override void AfterAction(Context.MvcContext ctx) { if (!HtmlHelper.CanHtml(ctx)) { return; } // 1)文章删除之后,app首页更新 HtmlMaker.GetHome().Process(ctx.app.Id); // 2)删除文章详细页 HtmlMaker.GetDetail().Delete(_contentPost); // 3) 其他生成工作放到队列中 JobManager.PostDelete(_contentPost); }
public virtual void Execute() { logger.Info("begin execute"); List <ContentApp> apps = ContentApp.find("OwnerType=:otype").set("otype", typeof(Site).FullName).list(); foreach (ContentApp app in apps) { ContentSetting setting = app.GetSettingsObj(); if (setting.IsAutoHtml == 0) { logger.Info("skip home, appId=" + app.Id); continue; } HtmlMaker.GetHome().Process(app.Id); logger.Info("make home, appId=" + app.Id); } }
public override void AfterAction(MvcContext ctx) { if (!HtmlHelper.CanHtml(ctx)) { return; } // 1)文章更新之后,比如标题被修改,那么app首页要更新 HtmlMaker.GetHome().Process(ctx.app.Id); // 2)详细页设置 ContentPost post = postService.GetById(ctx.route.id, ctx.owner.Id); HtmlMaker.GetDetail().Process(post); // 3) 其他生成工作放到队列中 JobManager.PostUpdate(post); }
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); } }