public void CreateContentHtml(CommonModelInfo commonModelInfo) { NodeInfo cacheNodeById = EasyOne.Contents.Nodes.GetCacheNodeById(commonModelInfo.NodeId); if (cacheNodeById.IsCreateContentPage && (cacheNodeById.PurviewType <= 0)) { TemplateInfo templateInfo = new TemplateInfo(); NameValueCollection values = new NameValueCollection(); values.Add("id", commonModelInfo.GeneralId.ToString()); values.Add("page", "1"); templateInfo.QueryList = values; templateInfo.CurrentPage = 1; templateInfo.RootPath = this.PhysicalApplicationPath; templateInfo.SiteUrl = this.SiteUrl; templateInfo.IsDynamicPage = false; templateInfo.PageType = 0; templateInfo.PageName = this.TemplatePageName(commonModelInfo, cacheNodeById); templateInfo.TemplateContent = Template.GetTemplateContent(ItemTemplateFilePath(commonModelInfo), this.PhysicalApplicationPath); int pageNum = 0; try { TemplateTransform.GetHtml(templateInfo); } catch { this.CreateMessage = string.Concat(new object[] { "<li>第<font color='red'><b>", this.CreateCompleted + 1, "</b></font>条信息生成失败。 ID:", commonModelInfo.GeneralId.ToString(), " 标题:<a target=_blank href=#>", commonModelInfo.Title, "</a>内容解析出现异常,跳过生成</li>", this.CreateMessage }); } finally { string str = string.Empty; string pageName = string.Empty; pageNum = templateInfo.PageNum; HtmlAbstract.AddHeardRunatServer(templateInfo, pageName); if (templateInfo.TemplateContent.IndexOf("$$$EasyOne.ChargeTips$$$", StringComparison.Ordinal) > 0) { string newValue = ChargeTipsMessage(commonModelInfo.GeneralId, commonModelInfo.ModelId); templateInfo.TemplateContent = templateInfo.TemplateContent.Replace("$$$EasyOne.ChargeTips$$$", newValue); pageNum = 0; } pageName = ContentManage.ContentHtmlName(commonModelInfo, cacheNodeById, 0); str = VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteOption.CreateHtmlPath) + pageName; FileSystemObject.WriteFile(VirtualPathUtility.AppendTrailingSlash(this.PhysicalApplicationPath) + str, templateInfo.TemplateContent); string str4 = (VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteInfo.VirtualPath) + str).Replace("//", "/"); this.CreateMessage = string.Concat(new object[] { "<li>成功生成第<font color='blue'><b>", this.CreateCompleted + 1, "</b></font>条信息。 ID:", commonModelInfo.GeneralId.ToString(), " 标题:<a target=_blank href=", str4, ">", commonModelInfo.Title, "</a></li>", this.CreateMessage }); } if (pageNum > 1) { for (int i = 1; i < pageNum; i++) { templateInfo.TemplateContent = Template.GetTemplateContent(ItemTemplateFilePath(commonModelInfo), this.PhysicalApplicationPath); values = new NameValueCollection(); values.Add("id", commonModelInfo.GeneralId.ToString()); values.Add("page", (i + 1).ToString()); templateInfo.QueryList = values; templateInfo.PageName = this.TemplatePageName(commonModelInfo, cacheNodeById); templateInfo.CurrentPage = i + 1; TemplateTransform.GetHtml(templateInfo); string str5 = ContentManage.ContentHtmlName(commonModelInfo, cacheNodeById, i + 1); HtmlAbstract.AddHeardRunatServer(templateInfo, str5); string str6 = VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteOption.CreateHtmlPath) + str5; FileSystemObject.WriteFile(VirtualPathUtility.AppendTrailingSlash(this.PhysicalApplicationPath) + str6, templateInfo.TemplateContent); string str7 = (VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteInfo.VirtualPath) + str6).Replace("//", "/"); this.CreateMessage = string.Concat(new object[] { "<li>成功生成第<font color='blue'><b>", this.CreateCompleted + 1, "</b></font>篇文章的第<font color='red'><b>", i, "</b></font>个分页。。 ID:", commonModelInfo.GeneralId.ToString(), " 标题:<a target=_blank href=", str7, ">", commonModelInfo.Title, "</a></li>", this.CreateMessage }); if ((i % 20) == 0) { this.CreateMessage = "为了缓解服务器压力,暂停一秒生成"; Thread.Sleep(0x3e8); } } } ContentManage.UpdateCreateTime(commonModelInfo.GeneralId, new DateTime?(DateTime.Now)); if (this.m_EnableCreateNodePage) { HtmlCategory category = new HtmlCategory(); category.PhysicalApplicationPath = this.PhysicalApplicationPath; category.SiteUrl = this.SiteUrl; category.CreateNodesHtml(cacheNodeById); } if (this.m_EnableCreateIndexPage) { HtmlCategory category2 = new HtmlCategory(); category2.PhysicalApplicationPath = this.PhysicalApplicationPath; category2.SiteUrl = this.SiteUrl; NodeInfo nodeInfo = EasyOne.Contents.Nodes.GetCacheNodeById(-2); category2.CreateNodesHtml(nodeInfo); } } }