Пример #1
0
        public IActionResult Save(cms_channel dto, int sub_channel)
        {
            dto.channel_href  = dto.channel_href ?? "";
            dto.channel_image = dto.channel_image ?? "";

            if (dto.link_type == 2)
            {
                if (sub_channel > 0)
                {
                    dto.channel_href = $"/channel/{sub_channel}";
                }
            }
            if (dto.id == 0)
            {
                dto.insert_id   = RequestHelper.AdminInfo().Id;
                dto.insert_time = DateTime.Now;
                dto             = _channelApp.Insert(dto);
            }
            else
            {
                _channelApp.Update(dto);
            }
            ChannelManagerCache.AddChannel(dto);
            return(Success("保存成功"));
        }
Пример #2
0
        /// <summary>
        /// 获取导航数据
        /// </summary>
        /// <param name="channelId"></param>
        /// <returns></returns>
        private string GetChannels(int channelId)
        {
            List <string> channelNames = new List <string>();

            var channel = ChannelManagerCache.GetChannel(channelId);

            if (channel != null)
            {
                channelNames.Insert(0, channel.channel_name);
                int channelPid = channel.parent_id;
                while (channelPid > 0)
                {
                    channel = ChannelManagerCache.GetChannel(channelPid);
                    if (channel != null)
                    {
                        channelNames.Insert(0, channel.channel_name);
                        channelPid = channel.parent_id;
                    }
                }
            }

            if (channelNames.Count == 0)
            {
                return("首页");
            }

            return(string.Join('>', channelNames));
        }
Пример #3
0
        public IActionResult Index(int channelId, int id)
        {
            if (id == 0)
            {
                return(Redirect("/404.html"));
            }


            var template = ChannelManagerCache.GetContentTemplate(channelId);

            if (template == null)
            {
                return(Redirect("/404.html"));
            }
            var content = _contentApp.GetContentInfo(id);

            if (content == null)
            {
                return(Redirect("/404.html"));
            }
            GenerateContent gen = new GenerateContent();
            var             ret = gen.GenerateContentHtml(content, template);

            if (!ret.genStatus)
            {
                return(Redirect("/404.html"));
            }
            return(Html(ret.contentHtml));
        }
Пример #4
0
        /// <summary>
        /// 获取栏目数据
        /// </summary>
        /// <param name="channelId"></param>
        /// <returns></returns>
        public ChannelModel GetChannel(int channelId)
        {
            var channel = ChannelManagerCache.GetChannel(channelId);

            if (channel == null)
            {
                return(null);
            }

            var model = new ChannelModel();

            model.id               = channel.id;
            model.parent_id        = channel.parent_id;
            model.sort_num         = channel.sort_num;
            model.channel_name     = channel.channel_name;
            model.channel_index    = channel.channel_index;
            model.channel_image    = channel.channel_image;
            model.channel_href     = channel.channel_href;
            model.channel_template = channel.channel_template;
            model.dis_drawing      = channel.dis_drawing;
            model.current          = 1;
            if (string.IsNullOrEmpty(model.channel_href))
            {
                model.channel_href = $"/channel/{channelId}";
            }
            model.location = GetNaviLocation(channelId);
            return(model);
        }
        /// <summary>
        /// 获取栏目定位
        /// </summary>
        /// <param name="channelId"></param>
        /// <returns>首页>新闻中心</returns>
        private string GetNaviLocation(int channelId)
        {
            List <string> channelNames = new List <string>();

            var channel = ChannelManagerCache.GetChannel(channelId);

            if (channel != null)
            {
                string channelHref = $"<a href='/news/{channel.id}'>{channel.channel_name}</a>";
                channelNames.Insert(0, channelHref);
                int channelPid = channel.parent_id;
                while (channelPid > 0)
                {
                    channel = ChannelManagerCache.GetChannel(channelPid);
                    if (channel != null)
                    {
                        string channelHref2 = "<a href='/index.html'>首页</a>";
                        if (channel.channel_index != "首页")
                        {
                            channelHref2 = $"<a href='/news/{channel.id}'>{channel.channel_name}</a>";
                        }
                        channelNames.Insert(0, channelHref2);
                        channelPid = channel.parent_id;
                    }
                }
            }

            if (channelNames.Count == 0)
            {
                return("<a href='/index.html'>首页</a>");
            }

            return(string.Join('>', channelNames));
        }
Пример #6
0
        /// <summary>
        /// 保存数据
        /// </summary>
        /// <param name="dto"></param>
        public void SaveContent(cms_content dto, LoginUserDto loginUser)
        {
            dto.sub_title    = dto.sub_title ?? "";
            dto.summary      = dto.summary ?? "";
            dto.content      = dto.content ?? "";
            dto.author       = dto.author ?? "";
            dto.source       = dto.source ?? "";
            dto.content_href = dto.content_href ?? "";
            dto.cover_image  = dto.cover_image ?? "";
            dto.update_by    = loginUser.LoginName;
            dto.update_time  = DateTime.Now;
            if (dto.id == 0)
            {
                dto.dept_id     = loginUser.DeptId;
                dto.create_by   = loginUser.LoginName;
                dto.create_time = dto.update_time;

                long contentId = Sqldb.Insert(dto).ExecuteIdentity();
                ChannelManagerCache.SetChannelLink(dto.channel_id, (int)contentId);
                //生成文章
                //GenerateContent generate = new GenerateContent();
                //generate.CreateHtml((int)contentId);
            }
            else
            {
                Sqldb.Update <cms_content>().SetSource(dto).ExecuteAffrows();
                //生成文章
                // GenerateContent generate = new GenerateContent();
                //generate.CreateHtml(dto.id);
            }
        }
Пример #7
0
        public static ChannelInfo GetChannelInfo(int siteId, int channelId)
        {
            ChannelInfo nodeInfo = null;
            var         dict     = ChannelManagerCache.GetChannelInfoDictionaryBySiteId(siteId);

            dict?.TryGetValue(channelId, out nodeInfo);
            return(nodeInfo);
        }
        public static ChannelInfo GetChannelInfo(int siteId, int channelId)
        {
            ChannelInfo channelInfo = null;
            var         dict        = ChannelManagerCache.GetChannelInfoDictionaryBySiteId(siteId);

            if (channelId == 0)
            {
                channelId = siteId;
            }
            dict?.TryGetValue(Math.Abs(channelId), out channelInfo);
            return(channelInfo);
        }
Пример #9
0
        public static int GetChannelIdByIndexName(int siteId, string indexName)
        {
            if (string.IsNullOrEmpty(indexName))
            {
                return(0);
            }

            var dict        = ChannelManagerCache.GetChannelInfoDictionaryBySiteId(siteId);
            var channelInfo = dict.Values.FirstOrDefault(x => x != null && x.IndexName == indexName);

            return(channelInfo?.Id ?? 0);
        }
Пример #10
0
        /// <summary>
        /// 返回渲染后的页面文件
        /// </summary>
        /// <param name="content"></param>
        /// <param name="template"></param>
        /// <returns></returns>
        public (bool genStatus, string contentHtml) GenerateContentHtml(int channelId, int id)
        {
            try
            {
                Stopwatch watcher = new Stopwatch();
                watcher.Start();
                var templateModel = ChannelManagerCache.GetContentTemplate(channelId);
                if (templateModel == null)
                {
                    return(false, "");
                }
                var content = _contentApp.GetContentInfo(id);
                if (content == null)
                {
                    return(false, "");
                }
                //加载模板 先取缓存,没有再初始化一个并且加入缓存
                this.Document = RenderDocumentCache.GetRenderDocument(templateModel.id);
                if (this.Document == null)
                {
                    string templateFile = Path.Combine(GlobalContext.WebRootPath, templateModel.template_file);
                    this.Document = new TemplateDocument(templateModel.template_content, GlobalContext.WebRootPath, templateFile);
                    RenderDocumentCache.AddRenderDocument(templateModel.id, this.Document);
                }

                this.Document.Variables.SetValue("this", this);
                //站点基本信息
                var site = SiteManagerCache.GetSiteInfo();
                this.Document.Variables.SetValue("site", site);
                //设置顶部导航条数据
                var navigations = _contentApp.GetChannelTree();
                this.Document.Variables.SetValue("navigations", navigations);

                //获取当前文章信息
                this.Document.Variables.SetValue("content", content);
                string renderHtml = this.Document.GetRenderText();
                renderHtml = HtmlPlayerHandler.CreateVideo(renderHtml);
                watcher.Stop();
                string msg = $"渲染内容页耗时:{watcher.ElapsedMilliseconds} ms";

                LoggerHelper.Info(msg);
                return(true, renderHtml);
            }
            catch (Exception ex)
            {
                LoggerHelper.Exception(ex);
            }
            return(false, "");
        }
Пример #11
0
        /// <summary>
        /// 获取栏目数据列表 必须设置首页栏目
        /// </summary>
        /// <returns></returns>
        public List <ChannelModel> GetChannelTree(int channleId = 0)
        {
            var channels = ChannelManagerCache.GetChannelList();
            var homeId   = channels.Where(s => s.channel_index == "首页").Select(s => s.id).FirstOrDefault();

            if (homeId == 0)
            {
                return(new List <ChannelModel>());
            }
            //获取首页栏目下的第一层栏目
            //var topChannels = channels.Where(s => s.parent_id == homeId)
            //    .OrderBy(s => s.sort_num)
            //    .Select(s => new ChannelModel {
            //        id =s.id, parent_id =s.parent_id ,
            //        sort_num=s.sort_num,
            //        channel_name=s.channel_name,
            //        channel_index=s.channel_index,
            //        channel_image=s.channel_image,
            //        channel_href=s.channel_href,
            //        channel_template=s.channel_template,
            //    }).ToList();
            //if (topChannels.Count == 0)
            //{
            //    return topChannels;
            //}
            ////设置连接和导航
            //topChannels.ForEach(s =>
            //{
            //    if (string.IsNullOrEmpty(s.channel_href))
            //    {
            //        s.channel_href = $"/news/{s.id}";
            //        s.navigation = GetNaviLocation(s.id);
            //    }
            //});
            var list = InitChild(homeId, channels, channleId);
            var home = new ChannelModel {
                id = 0, channel_href = "/index.html", channel_name = "首页"
            };

            if (channleId == 0)
            {
                home.current = 1;
            }
            list.Insert(0, home);
            return(list);
        }
Пример #12
0
        public ActionResult Form(int id)
        {
            int channelId = RequestHelper.GetQueryInt("channelId");

            if (channelId > 0)
            {
                var channel = ChannelManagerCache.GetChannel(channelId);
                ViewBag.ChannelName = channel.channel_name;
            }
            else
            {
                ViewBag.ChannelName = "";
            }
            ViewBag.Id = id;

            return(View());
        }
Пример #13
0
        public static List <int> GetChannelIdList(int siteId, string channelGroup)
        {
            var channelInfoList = new List <ChannelInfo>();
            var dic             = ChannelManagerCache.GetChannelInfoDictionaryBySiteId(siteId);

            foreach (var channelInfo in dic.Values)
            {
                if (string.IsNullOrEmpty(channelInfo.GroupNameCollection))
                {
                    continue;
                }

                if (StringUtils.Contains(channelInfo.GroupNameCollection, channelGroup))
                {
                    channelInfoList.Add(channelInfo);
                }
            }
            return(channelInfoList.OrderBy(c => c.Taxis).Select(channelInfo => channelInfo.Id).ToList());
        }
Пример #14
0
        public static int GetChannelIdByParentIdAndChannelName(int siteId, int parentId, string channelName, bool recursive)
        {
            if (parentId <= 0 || string.IsNullOrEmpty(channelName))
            {
                return(0);
            }

            var dict            = ChannelManagerCache.GetChannelInfoDictionaryBySiteId(siteId);
            var channelInfoList = dict.Values.OrderBy(x => x.Taxis).ToList();

            ChannelInfo channelInfo;

            if (recursive)
            {
                if (siteId == parentId)
                {
                    channelInfo = channelInfoList.FirstOrDefault(x => x.ChannelName == channelName);

                    //sqlString = $"SELECT Id FROM siteserver_Channel WHERE (SiteId = {siteId} AND ChannelName = '{AttackUtils.FilterSql(channelName)}') ORDER BY Taxis";
                }
                else
                {
                    channelInfo = channelInfoList.FirstOrDefault(x => (x.ParentId == parentId || TranslateUtils.StringCollectionToIntList(x.ParentsPath).Contains(parentId)) && x.ChannelName == channelName);

//                    sqlString = $@"SELECT Id
//FROM siteserver_Channel
//WHERE ((ParentId = {parentId}) OR
//      (ParentsPath = '{parentId}') OR
//      (ParentsPath LIKE '{parentId},%') OR
//      (ParentsPath LIKE '%,{parentId},%') OR
//      (ParentsPath LIKE '%,{parentId}')) AND ChannelName = '{AttackUtils.FilterSql(channelName)}'
//ORDER BY Taxis";
                }
            }
            else
            {
                channelInfo = channelInfoList.FirstOrDefault(x => x.ParentId == parentId && x.ChannelName == channelName);

                //sqlString = $"SELECT Id FROM siteserver_Channel WHERE (ParentId = {parentId} AND ChannelName = '{AttackUtils.FilterSql(channelName)}') ORDER BY Taxis";
            }

            return(channelInfo?.Id ?? 0);
        }
Пример #15
0
        /// <summary>
        /// 返回渲染后的页面文件
        /// </summary>
        /// <param name="content"></param>
        /// <param name="template"></param>
        /// <returns></returns>
        public (bool genStatus, string contentHtml) GenerateContentHtml(int channelId, int id)
        {
            try
            {
                Stopwatch watcher = new Stopwatch();
                watcher.Start();
                var templateModel = ChannelManagerCache.GetContentTemplate(channelId);
                if (templateModel == null)
                {
                    return(false, "");
                }
                var content = _contentApp.GetContentInfo(id);
                if (content == null)
                {
                    return(false, "");
                }
                //加载模板 先取缓存,没有再初始化一个并且加入缓存
                this.Document = RenderDocumentCache.GetRenderDocument(templateModel.id);
                if (this.Document == null)
                {
                    string templateFile = Path.Combine(GlobalParamsDto.WebRoot, templateModel.template_file);
                    this.Document = new TemplateDocument(templateModel.template_content, GlobalParamsDto.WebRoot, templateFile);
                    RenderDocumentCache.AddRenderDocument(templateModel.id, this.Document);
                }

                this.Document.Variables.SetValue("this", this);
                this.Document.Variables.SetValue("news", content);
                string renderHtml = this.Document.GetRenderText();
                renderHtml = HtmlElementHandler.CreateVideo(renderHtml);
                watcher.Stop();
                string msg = $"渲染内容页耗时:{watcher.ElapsedMilliseconds} ms";

                LogNHelper.Info(msg);
                return(true, renderHtml);
            }
            catch (Exception ex)
            {
                LogNHelper.Exception(ex);
            }
            return(false, "");
        }
        public static IList <ChannelInfo> GetChildren(int siteId, int parentId)
        {
            var list = new List <ChannelInfo>();

            var dic = ChannelManagerCache.GetChannelInfoDictionaryBySiteId(siteId);

            foreach (var channelInfo in dic.Values)
            {
                if (channelInfo == null)
                {
                    continue;
                }
                if (channelInfo.ParentId == parentId)
                {
                    channelInfo.Children = GetChildren(siteId, channelInfo.Id);
                    list.Add(channelInfo);
                }
            }

            return(list);
        }
Пример #17
0
        public IActionResult Save(cms_content dto)
        {
            dto.sub_title    = dto.sub_title ?? "";
            dto.summary      = dto.summary ?? "";
            dto.content      = dto.content ?? "";
            dto.author       = dto.author ?? "";
            dto.source       = dto.source ?? "";
            dto.content_href = dto.content_href ?? "";
            dto.cover_image  = dto.cover_image ?? "";
            var user = RequestHelper.AdminInfo();

            if (dto.id == 0)
            {
                dto.dept_id   = user.DepartmentId;
                dto.insert_id = user.Id;
                if (dto.insert_time == DateTime.MinValue)
                {
                    dto.insert_time = DateTime.Now;
                }

                long contentId = _contentApp.Insert(dto);
                ChannelManagerCache.SetChannelLink(dto.channel_id, (int)contentId);
                //生成文章
                //GenerateContent generate = new GenerateContent();
                //generate.CreateHtml((int)contentId);
            }
            else
            {
                dto.update_id   = dto.insert_id;
                dto.update_time = dto.insert_time;
                _contentApp.Update(dto);

                //生成文章
                // GenerateContent generate = new GenerateContent();
                //generate.CreateHtml(dto.id);
            }

            return(Success("保存成功"));
        }
Пример #18
0
        public static List <int> GetChannelIdList(int siteId)
        {
            var dic = ChannelManagerCache.GetChannelInfoDictionaryBySiteId(siteId);

            return(dic.Keys.Where(channelId => channelId > 0).ToList());
        }
Пример #19
0
 public static void RemoveCache(int siteId)
 {
     ChannelManagerCache.Remove(siteId);
     Node.ClearCache();
 }
Пример #20
0
        public static List <int> GetChannelIdList(ChannelInfo channelInfo, EScopeType scopeType, string group, string groupNot, string contentModelPluginId)
        {
            if (channelInfo == null)
            {
                return(new List <int>());
            }

            var dic             = ChannelManagerCache.GetChannelInfoDictionaryBySiteId(channelInfo.SiteId);
            var channelInfoList = new List <ChannelInfo>();

            if (channelInfo.ChildrenCount == 0)
            {
                if (scopeType != EScopeType.Children && scopeType != EScopeType.Descendant)
                {
                    channelInfoList.Add(channelInfo);
                }
            }
            else if (scopeType == EScopeType.Self)
            {
                channelInfoList.Add(channelInfo);
            }
            else if (scopeType == EScopeType.All)
            {
                foreach (var nodeInfo in dic.Values)
                {
                    if (nodeInfo.Id == channelInfo.Id || nodeInfo.ParentId == channelInfo.Id || StringUtils.In(nodeInfo.ParentsPath, channelInfo.Id))
                    {
                        channelInfoList.Add(nodeInfo);
                    }
                }
            }
            else if (scopeType == EScopeType.Children)
            {
                foreach (var nodeInfo in dic.Values)
                {
                    if (nodeInfo.ParentId == channelInfo.Id)
                    {
                        channelInfoList.Add(nodeInfo);
                    }
                }
            }
            else if (scopeType == EScopeType.Descendant)
            {
                foreach (var nodeInfo in dic.Values)
                {
                    if (nodeInfo.ParentId == channelInfo.Id || StringUtils.In(nodeInfo.ParentsPath, channelInfo.Id))
                    {
                        channelInfoList.Add(nodeInfo);
                    }
                }
            }
            else if (scopeType == EScopeType.SelfAndChildren)
            {
                foreach (var nodeInfo in dic.Values)
                {
                    if (nodeInfo.Id == channelInfo.Id || nodeInfo.ParentId == channelInfo.Id)
                    {
                        channelInfoList.Add(nodeInfo);
                    }
                }
            }

            var filteredChannelInfoList = new List <ChannelInfo>();

            foreach (var nodeInfo in channelInfoList)
            {
                if (!string.IsNullOrEmpty(group))
                {
                    if (!StringUtils.In(nodeInfo.GroupNameCollection, group))
                    {
                        continue;
                    }
                }
                if (!string.IsNullOrEmpty(groupNot))
                {
                    if (StringUtils.In(nodeInfo.GroupNameCollection, groupNot))
                    {
                        continue;
                    }
                }
                if (!string.IsNullOrEmpty(contentModelPluginId))
                {
                    if (!StringUtils.EqualsIgnoreCase(nodeInfo.ContentModelPluginId, contentModelPluginId))
                    {
                        continue;
                    }
                }
                filteredChannelInfoList.Add(nodeInfo);
            }

            return(filteredChannelInfoList.OrderBy(c => c.Taxis).Select(channelInfoInList => channelInfoInList.Id).ToList());
        }
Пример #21
0
        public static List <int> GetChannelIdList(int siteId)
        {
            var dic = ChannelManagerCache.GetChannelInfoDictionaryBySiteId(siteId);

            return(dic.Values.OrderBy(c => c.Taxis).Select(channelInfo => channelInfo.Id).ToList());
        }
Пример #22
0
        public static List <ChannelInfo> GetChannelInfoList(int siteId)
        {
            var dic = ChannelManagerCache.GetChannelInfoDictionaryBySiteId(siteId);

            return(dic.Values.Where(nodeInfo => nodeInfo != null).ToList());
        }
Пример #23
0
 public static void UpdateCache(int siteId, ChannelInfo channelInfo)
 {
     ChannelManagerCache.Update(siteId, channelInfo);
     StlChannelCache.ClearCache();
 }
Пример #24
0
 public static void RemoveCacheBySiteId(int siteId)
 {
     ChannelManagerCache.Remove(siteId);
     StlChannelCache.ClearCache();
 }
Пример #25
0
 public IActionResult DeleteById(int id)
 {
     _channelApp.DelByIds(id);
     ChannelManagerCache.RemoveChannel(id);
     return(Success("删除成功"));
 }
Пример #26
0
        /// <summary>
        /// 生成静态文档,channelId和contentId都为0的时候生成首页
        /// </summary>
        /// <param name="contentId">文章id</param>
        /// <param name="channelId">栏目id</param>
        /// <param name="channelPage">栏目页的分页页面</param>
        /// <returns></returns>
        public GenerateResultDto GenerateHtml(int contentId, int channelId, int channelPage)
        {
            GenerateResultDto ret = new GenerateResultDto();

            try
            {
                //获取模板信息
                cms_template templateModel = null;
                ChannelModel channelModel  = null;
                ContentModel contentModel  = null;
                if (channelId == 0 && contentId == 0)
                {
                    templateModel = TemplateManagerCache.GetHomeTemplate();
                    RenderMode    = 1;
                }
                else if (channelId > 0)
                {
                    channelModel  = generateApp.GetChannel(channelId);
                    templateModel = ChannelManagerCache.GetChannelTemplate(channelId);
                    if (channelModel == null)
                    {
                        ret.Message = "栏目数据查找失败";
                        return(ret);
                    }
                    RenderMode = 2;
                }
                else if (contentId > 0)
                {
                    contentModel  = generateApp.GetContentInfo(contentId);
                    channelModel  = generateApp.GetChannel(contentModel.channel_id);
                    templateModel = ChannelManagerCache.GetContentTemplate(contentModel.channel_id);

                    if (contentModel == null)
                    {
                        ret.Message = "内容数据查找失败";
                        return(ret);
                    }

                    RenderMode = 3;
                }

                if (templateModel == null || templateModel.id == 0)
                {
                    throw new Exception("找不到模板");
                }

                //加载模板 先取缓存,没有再初始化一个并且加入缓存
                this.Document = RenderDocumentCache.GetRenderDocument(templateModel.id);
                if (this.Document == null)
                {
                    string templateFile = Path.Combine(GlobalContext.WebRootPath, templateModel.template_file);
                    this.Document = new TemplateDocument(templateModel.template_content, GlobalContext.WebRootPath, templateFile);
                    RenderDocumentCache.AddRenderDocument(templateModel.id, this.Document);
                }

                #region 公用数据
                //加入基本信息
                this.Document.Variables.SetValue("this", this);
                //站点基本信息
                var site = SiteManagerCache.GetSiteInfo();
                this.Document.Variables.SetValue("site", site);
                //添加所有导航条数据
                var channels = generateApp.GetChannelTree();
                this.Document.Variables.SetValue("channels", channels);

                //解析模板中的栏目文章模板
                ElementCollection <Template> templateContents = this.Document.GetChildTemplatesByName("contents");
                foreach (Template template in templateContents)
                {
                    //从第几条数据开始
                    string startNum = template.Attributes.GetValue("startNum", "1");
                    string total    = template.Attributes.GetValue("total", "10");
                    //根据模板块里定义的type属性条件取得新闻数据
                    var data = generateApp.GetContentSummary(template.Attributes.GetValue("channelIndex"), int.Parse(startNum), int.Parse(total));
                    //设置变量newsdata的值
                    template.Variables.SetValue("contents", data);
                }

                //解析模板中的channel标签
                ElementCollection <Template> templateChannel = this.Document.GetChildTemplatesByName("channel");
                foreach (Template template in templateChannel)
                {
                    string channelIndex = template.Attributes.GetValue("channelIndex", "#");
                    //根据模板块里定义的type属性条件取得新闻数据
                    var channel = ChannelManagerCache.GetChannelByIndex(channelIndex);
                    if (channel != null)
                    {
                        ChannelModel inChannelModel = generateApp.GetChannel(channel.id);
                        //设置变量newsdata的值
                        template.Variables.SetValue("channel", inChannelModel);
                    }
                }
                #endregion

                //渲染首页
                if (RenderMode == 1)
                {
                    string contentFilePath = Path.Combine(GlobalContext.WebRootPath, "index.html");
                    using (var filestream = new FileStream(contentFilePath, FileMode.Create, FileAccess.ReadWrite))
                    {
                        string renderHtml = this.Document.GetRenderText();

                        using (StreamWriter writer = new StreamWriter(filestream, Encoding.UTF8))
                        {
                            writer.WriteLine(renderHtml);
                            writer.Flush();
                        }
                    }

                    ret.Status = true;
                    return(ret);
                }
                //栏目数据
                if (RenderMode == 2)
                {
                    //获取当前栏目下的文章列表
                    //解析文章列表模板设置数据源 添加id为contents 模板
                    Tag element  = this.Document.GetChildTagById("contents");
                    int total    = int.Parse(element.Attributes.GetValue("total", "8"));
                    int startNum = int.Parse(element.Attributes.GetValue("startNum", "1"));//从第几条开始
                    //跳过多少条数据
                    int skipNum         = (channelPage - 1) * total + (startNum - 1);
                    var channelContents = generateApp.GetContentSummaryByChannelId(channelId, skipNum, total);


                    this.Document.Variables.SetValue("contents", channelContents);
                    this.Document.Variables.SetValue("channel", channelModel);

                    string renderHtml = this.Document.GetRenderText();
                    ret.Status = true;
                    ret.Html   = renderHtml;
                    return(ret);
                }
                //文章数据
                if (RenderMode == 3)
                {
                    this.Document.Variables.SetValue("channel", channelModel);
                    this.Document.Variables.SetValue("content", contentModel);
                    //渲染内容数据
                    string renderHtml = this.Document.GetRenderText();
                    renderHtml = HtmlPlayerHandler.CreateVideo(renderHtml);
                    ret.Status = true;
                    ret.Html   = renderHtml;
                    return(ret);
                }
            }
            catch (Exception ex)
            {
                LoggerHelper.Exception(ex);
            }

            return(ret);
        }