Example #1
0
        /// <summary>
        /// 章节的状态
        /// </summary>
        /// <param name="olid"></param>
        /// <returns></returns>
        public Dictionary <string, object> State(int olid)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();

            Song.Entities.Accounts acc = Extend.LoginState.Accounts.CurrentUser;
            dic.Add("isLogin", acc != null);    //学员是否登录
            //
            Song.Entities.Outline outline = Business.Do <IOutline>().OutlineSingle(olid);
            if (outline == null)
            {
                throw new Exception("章节不存在");
            }
            dic.Add("Name", outline.Ol_Name);
            Song.Entities.Course course = Business.Do <ICourse>().CourseSingle(outline.Cou_ID);
            if (course == null)
            {
                throw new Exception("课程不存在");
            }
            dic.Add("Course", course.Cou_Name);
            Song.Entities.Organization orgin;
            //是否限制在桌面应用中打开
            dic.Add("DeskAllow", this.getDeskallow(course, outline, out orgin));
            //是否在切换浏览器时继续播放
            dic.Add("SwitchPlay", this.getSwitchPlay(course, acc, orgin));
            //是否免费,或是限时免费
            if (course.Cou_IsLimitFree)
            {
                DateTime freeEnd = course.Cou_FreeEnd.AddDays(1).Date;
                if (!(course.Cou_FreeStart <= DateTime.Now && freeEnd >= DateTime.Now))
                {
                    course.Cou_IsLimitFree = false;
                }
            }
            //是否可以学习,是否购买
            bool isStudy = false, isBuy = false, canStudy = false;

            if (acc != null)
            {
                isStudy = Business.Do <ICourse>().Study(course.Cou_ID, acc.Ac_ID);
                isBuy   = course.Cou_IsFree || course.Cou_IsLimitFree ? true : Business.Do <ICourse>().IsBuy(course.Cou_ID, acc.Ac_ID);
                //学习记录
                Song.Entities.LogForStudentStudy studyLog = Business.Do <IStudent>().LogForStudySingle(acc.Ac_ID, outline.Ol_ID);
                dic.Add("StudyTime", studyLog != null ? studyLog.Lss_StudyTime : 0);
                dic.Add("PlayTime", studyLog != null ? studyLog.Lss_PlayTime : 0);
            }
            dic.Add("isStudy", isStudy);
            dic.Add("isBuy", isBuy);
            //是否可以学习,如果是免费或已经选修便可以学习,否则当前课程允许试用且当前章节是免费的,也可以学习
            canStudy = isBuy || (isStudy && outline.Ol_IsUse && outline.Ol_IsFinish && course.Cou_IsTry && outline.Ol_IsFree);
            dic.Add("canStudy", canStudy);
            //是否有知识库
            int knlCount = Business.Do <IKnowledge>().KnowledgeOfCount(-1, course.Cou_ID, -1, true);

            dic.Add("isKnl", knlCount > 0 && canStudy);

            //是否有视频,是否为外链视频

            List <Song.Entities.Accessory> videos = Business.Do <IAccessory>().GetAll(outline.Ol_UID, "CourseVideo");
            bool existVideo = videos.Count > 0;

            dic.Add("outerVideo", existVideo && (videos.Count > 0 && videos[0].As_IsOuter));    //站外视频,包括其它网站的视频,或是视频播放链接
            dic.Add("otherVideo", existVideo && (videos.Count > 0 && videos[0].As_IsOther));    //其它视频平台的链接
            if (videos.Count > 0)
            {
                string videoUrl = existVideo ? videos[0].As_FileName : string.Empty; //视频地址
                //如果是内部链接
                if (existVideo && !videos[0].As_IsOuter)
                {
                    videoUrl = Upload.Get[videos[0].As_Type].Virtual + videoUrl;
                    string ext = System.IO.Path.GetExtension(videoUrl).ToLower();
                    if (ext == ".flv")
                    {
                        videoUrl = Path.ChangeExtension(videoUrl, ".mp4");
                    }
                }
                dic.Add("urlVideo", canStudy ? videoUrl : string.Empty);
                outline.Ol_IsLive = false;
            }
            //直播
            bool isLive = outline.Ol_IsLive, isLiving = false;

            if (outline.Ol_IsLive)
            {
                string urlVideo = string.Empty;
                if (canStudy)
                {
                    //查询直播状态
                    pili_sdk.pili.StreamStatus status = Pili.API <IStream>().Status(outline.Ol_LiveID);
                    if (status != null)
                    {
                        pili_sdk.pili.Stream stream = status.Stream;
                        string proto = Business.Do <ILive>().GetProtocol; //协议,http还是https
                        urlVideo   = string.Format("{0}://{1}/{2}/{3}.m3u8", proto, stream.LiveHlsHost, stream.HubName, stream.Title);
                        isLiving   = status.Status == "connected";        //正在直播
                        existVideo = isLiving ? false : existVideo;
                    }
                }
                //直播播放地址
                if (!dic.ContainsKey("urlVideo"))
                {
                    dic.Add("urlVideo", urlVideo);
                }
                //直播开始或结束
                dic.Add("LiveStart", DateTime.Now > outline.Ol_LiveTime);
                dic.Add("LiveOver", outline.Ol_LiveTime.AddMinutes(outline.Ol_LiveSpan) < DateTime.Now);
            }
            dic.Add("isLive", outline.Ol_IsLive);      //是否为直播章节
            dic.Add("isLiving", isLiving && canStudy); //是否在直播中
            dic.Add("existVideo", existVideo && canStudy);

            //是否有课程内容
            bool isContext = !string.IsNullOrWhiteSpace(outline.Ol_Intro);

            dic.Add("isContext", isContext && canStudy);
            //是否有试题
            bool isQues = Business.Do <IOutline>().OutlineIsQues(outline.Ol_ID, true);

            dic.Add("isQues", isQues && canStudy);
            //是否有附件
            int accessCount = Business.Do <IAccessory>().OfCount(outline.Ol_UID, "Course");

            dic.Add("isAccess", accessCount > 0 && canStudy);
            //啥都没有(视频,内容,附件,试题,都没有)
            bool isNull = !(existVideo || isLive || isContext || isQues || isQues || accessCount > 0);

            dic.Add("isNull", isNull || !canStudy);
            return(dic);
        }
        protected override void InitPageTemplate(HttpContext context)
        {
            //if (!Extend.LoginState.Accounts.IsLogin || this.Account==null)
            //    context.Response.Redirect(WeiSha.Common.Login.Get["Accounts"].NoLoginPath.String);
            //自定义配置项
            Song.Entities.Organization org    = Business.Do <IOrganization>().OrganCurrent();
            WeiSha.Common.CustomConfig config = CustomConfig.Load(org.Org_Config);
            //
            //取当前章节
            ol = id < 1 ? Business.Do <IOutline>().OutlineFirst(couid, true)
                       : ol = Business.Do <IOutline>().OutlineSingle(id);
            //当前课程
            Song.Entities.Course course = Business.Do <ICourse>().CourseSingle(ol == null ? couid : ol.Cou_ID);
            if (course == null)
            {
                return;
            }
            #region 创建与学员的关联
            if (this.Account != null)
            {
                int  accid  = this.Account.Ac_ID;
                bool istudy = Business.Do <ICourse>().Study(course.Cou_ID, accid);
            }
            #endregion

            #region 章节输出

            //是否免费,或是限时免费
            if (course.Cou_IsLimitFree)
            {
                DateTime freeEnd = course.Cou_FreeEnd.AddDays(1).Date;
                if (!(course.Cou_FreeStart <= DateTime.Now && freeEnd >= DateTime.Now))
                {
                    course.Cou_IsLimitFree = false;
                }
            }
            this.Document.Variables.SetValue("course", course);
            Extend.LoginState.Accounts.Course(course);
            if (ol == null)
            {
                return;
            }
            //
            couid = ol.Cou_ID;
            id    = ol.Ol_ID;
            //入写章节id的cookie,当播放视频时会判断此处
            Response.Cookies.Add(new HttpCookie("olid", id.ToString()));
            outlines = Business.Do <IOutline>().OutlineAll(ol.Cou_ID, true);
            //是否学习当前课程
            if (course == null || this.Account == null)
            {
                isStudy = false;
            }
            else
            {
                isStudy = Business.Do <ICourse>().StudyIsCourse(this.Account.Ac_ID, course.Cou_ID);
            }
            this.Document.Variables.SetValue("isStudy", isStudy);
            //是否可以学习,如果是免费或已经选修便可以学习,否则当前课程允许试用且当前章节是免费的,也可以学习
            bool canStudy = isStudy || course.Cou_IsFree || course.Cou_IsLimitFree ? true : (course.Cou_IsTry && ol.Ol_IsFree);
            canStudy = canStudy && ol.Ol_IsUse && ol.Ol_IsFinish && this.Account != null;
            this.Document.Variables.SetValue("canStudy", canStudy);
            //课程章节列表
            this.Document.Variables.SetValue("outlines", outlines);
            //树形章节输出
            if (outlines.Length > 0)
            {
                this.Document.Variables.SetValue("olTree", Business.Do <IOutline>().OutlineTree(outlines));
            }
            this.Document.Variables.SetValue("outline", ol);
            #endregion
            //视频
            List <Song.Entities.Accessory> videos = Business.Do <IAccessory>().GetAll(ol.Ol_UID, "CourseVideo");
            if (videos.Count > 0)
            {
                if (videos[0].As_IsOuter)
                {
                    //如果是外部链接
                    this.Document.Variables.SetValue("video", videos[0]);
                }
                else
                {
                    //如果是内部链接
                    videos[0].As_FileName = Upload.Get[videos[0].As_Type].Virtual + videos[0].As_FileName;
                    try
                    {
                        string fileHy = Server.MapPath(videos[0].As_FileName);
                        if (!System.IO.File.Exists(fileHy))
                        {
                            string ext = System.IO.Path.GetExtension(fileHy).ToLower();
                            if (ext == ".mp4")
                            {
                                videos[0].As_FileName = Path.ChangeExtension(videos[0].As_FileName, ".flv");
                            }
                            if (ext == ".flv")
                            {
                                videos[0].As_FileName = Path.ChangeExtension(videos[0].As_FileName, ".mp4");
                            }
                        }
                        this.Document.Variables.SetValue("video", videos[0]);
                        if (Extend.LoginState.Accounts.IsLogin)
                        {
                            Song.Entities.LogForStudentStudy studyLog = Business.Do <IStudent>().LogForStudySingle(this.Account.Ac_ID, ol.Ol_ID);
                            if (studyLog != null)
                            {
                                this.Document.Variables.SetValue("studyLog", studyLog);
                                double historyPlay = (double)studyLog.Lss_PlayTime / 1000;
                                this.Document.Variables.SetValue("historyPlay", historyPlay);
                            }
                        }
                    }
                    catch
                    {
                    }
                }
                this.Document.Variables.SetValue("IsVideoNoload", config["IsVideoNoload"].Value.Boolean ?? false);
                state = state < 1 ? 1 : state;
            }
            //内容
            if (!string.IsNullOrWhiteSpace(ol.Ol_Intro))
            {
                state = state < 1 ? 2 : state;
            }
            //上级章节
            if (ol != null)
            {
                Song.Entities.Outline pat = Business.Do <IOutline>().OutlineSingle(ol.Ol_PID);
                this.Document.Variables.SetValue("pat", pat);
            }
            //附件
            List <Song.Entities.Accessory> access = Business.Do <IAccessory>().GetAll(ol.Ol_UID, "Course");
            if (access.Count > 0)
            {
                foreach (Accessory ac in access)
                {
                    ac.As_FileName = Upload.Get["Course"].Virtual + ac.As_FileName;
                }
                this.Document.Variables.SetValue("access", access);
                state = state < 1 ? 3 : state;
            }
            //当前章节是否有试题
            if (canStudy)
            {
                bool isQues = Business.Do <IOutline>().OutlineIsQues(ol.Ol_ID, true);
                this.Document.Variables.SetValue("isQues", isQues);
                if (isQues)
                {
                    state = state < 1 ? 4 : state;
                }
            }
            else
            {
                state = 0;
            }

            //章节事件
            OutlineEvent[] events = Business.Do <IOutline>().EventAll(-1, ol.Ol_ID, -1, true);
            this.Document.Variables.SetValue("events", events);
            this.Document.RegisterGlobalFunction(this.getEventQues);
            this.Document.RegisterGlobalFunction(this.getEventFeedback);
            this.Document.RegisterGlobalFunction(this.GetOrder);
            //状态
            this.Document.Variables.SetValue("state", state);
            this.Document.Variables.SetValue("olid", id);
        }
        protected override void InitPageTemplate(HttpContext context)
        {
            //当前章节,如果章节id,则取课程第一个章节
            Song.Entities.Outline ol = id < 1 ?
                                       Business.Do <IOutline>().OutlineFirst(couid, true)
                : Business.Do <IOutline>().OutlineSingle(id);
            couid = couid > 0 ? couid : (ol != null ? ol.Cou_ID : 0);
            //当前课程
            Song.Entities.Course course = Business.Do <ICourse>().CourseSingle(couid);
            if (course == null || !course.Cou_IsUse)
            {
                return;
            }
            this.Document.Variables.SetValue("course", course);
            //如果章节为空,则不再后面的了
            if (ol == null)
            {
                return;
            }
            this.Document.Variables.SetValue("outline", ol);
            this.Document.Variables.SetValue("olid", ol.Ol_ID.ToString());
            //上级章节
            this.Document.Variables.SetValue("pat", Business.Do <IOutline>().OutlineSingle(ol.Ol_PID));
            Response.Cookies.Add(new HttpCookie("olid", ol.Ol_ID.ToString()));
            //当前课程
            //Song.Entities.Course course = Business.Do<ICourse>().CourseSingle(couid >0 ? couid : ol.Cou_ID);
            //if (course == null || !course.Cou_IsUse) return;
            //是否免费,或是限时免费
            if (course.Cou_IsLimitFree)
            {
                DateTime freeEnd = course.Cou_FreeEnd.AddDays(1).Date;
                if (!(course.Cou_FreeStart <= DateTime.Now && freeEnd >= DateTime.Now))
                {
                    course.Cou_IsLimitFree = false;
                }
            }
            this.Document.Variables.SetValue("course", course);
            //判断是否允许在桌面应用中学习
            this.Document.Variables.SetValue("StudyForDeskapp", getForDeskapp(course, ol));
            //是否学习当前课程,如果没有学习且课程处于免费,则创建关联
            if (this.Account != null)
            {
                isStudy = Business.Do <ICourse>().Study(course.Cou_ID, this.Account.Ac_ID);
                isBuy   = course.Cou_IsFree || course.Cou_IsLimitFree ? true : Business.Do <ICourse>().IsBuy(course.Cou_ID, this.Account.Ac_ID);
            }
            this.Document.Variables.SetValue("isStudy", isStudy);
            this.Document.Variables.SetValue("isBuy", isBuy);
            //是否可以学习,如果是免费或已经选修便可以学习,否则当前课程允许试用且当前章节是免费的,也可以学习
            bool canStudy = isBuy || (isStudy && ol.Ol_IsUse && ol.Ol_IsFinish && course.Cou_IsTry && ol.Ol_IsFree);

            this.Document.Variables.SetValue("canStudy", canStudy);
            //记录学员当前学习的课程
            if (isStudy)
            {
                Extend.LoginState.Accounts.Course(course);
            }

            #region 章节输出
            // 当前课程的所有章节
            Song.Entities.Outline[] outlines = Business.Do <IOutline>().OutlineAll(ol.Cou_ID, true);
            //课程章节列表
            this.Document.Variables.SetValue("outlines", outlines);
            //树形章节输出
            if (outlines.Length > 0)
            {
                this.Document.Variables.SetValue("olTree", Business.Do <IOutline>().OutlineTree(outlines));
            }
            #endregion

            #region 内容输出
            CourseContext_State state = new CourseContext_State();
            //视频
            Song.Entities.Accessory video = getVideo(ol.Ol_UID);
            this.Document.Variables.SetValue("video", video);
            if (video != null)
            {
                state.Video = canStudy ? true : false;
            }
            if (Extend.LoginState.Accounts.IsLogin)
            {
                Song.Entities.LogForStudentStudy studyLog = Business.Do <IStudent>().LogForStudySingle(this.Account.Ac_ID, ol.Ol_ID);
                if (studyLog != null)
                {
                    this.Document.Variables.SetValue("studyLog", studyLog);
                    double historyPlay = (double)studyLog.Lss_PlayTime / 1000;
                    this.Document.Variables.SetValue("historyPlay", historyPlay);
                }
            }
            //内容
            if (!string.IsNullOrWhiteSpace(ol.Ol_Intro))
            {
                state.Context = canStudy ? true : false;
            }
            //附件
            List <Song.Entities.Accessory> access = Business.Do <IAccessory>().GetAll(ol.Ol_UID, "Course");
            if (access.Count > 0)
            {
                foreach (Accessory ac in access)
                {
                    ac.As_FileName = Upload.Get["Course"].Virtual + ac.As_FileName;
                }
                this.Document.Variables.SetValue("access", access);
                state.Attachment = canStudy ? true : false;
            }
            //当前章节是否有试题
            if (canStudy)
            {
                bool isQues = Business.Do <IOutline>().OutlineIsQues(ol.Ol_ID, true);
                if (isQues)
                {
                    state.Questions = canStudy ? true : false;
                }
                ;
            }
            state.JudgeNull(stateVal);
            this.Document.Variables.SetValue("state", state);
            #endregion

            //章节事件
            OutlineEvent[] events = Business.Do <IOutline>().EventAll(-1, ol.Ol_ID, -1, true);
            this.Document.Variables.SetValue("events", events);
            this.Document.RegisterGlobalFunction(this.getEventQues);
            this.Document.RegisterGlobalFunction(this.getEventFeedback);
            this.Document.RegisterGlobalFunction(this.GetOrder);
        }
Example #4
0
        protected override void InitPageTemplate(HttpContext context)
        {
            //当前课程
            Song.Entities.Course course = Business.Do <ICourse>().CourseSingle(couid);
            if (course == null || !course.Cou_IsUse)
            {
                return;
            }
            //是否免费,或是限时免费
            if (course.Cou_IsLimitFree)
            {
                DateTime freeEnd = course.Cou_FreeEnd.AddDays(1).Date;
                if (!(course.Cou_FreeStart <= DateTime.Now && freeEnd >= DateTime.Now))
                {
                    course.Cou_IsLimitFree = false;
                }
            }
            this.Document.Variables.SetValue("course", course);
            //是否学习当前课程,如果没有学习且课程处于免费,则创建关联
            if (this.Account != null)
            {
                isStudy = Business.Do <ICourse>().Study(course.Cou_ID, this.Account.Ac_ID);
                isBuy   = course.Cou_IsFree || course.Cou_IsLimitFree ? true : Business.Do <ICourse>().IsBuy(course.Cou_ID, this.Account.Ac_ID);
            }
            this.Document.Variables.SetValue("isStudy", isStudy);
            this.Document.Variables.SetValue("isBuy", isBuy);
            //记录学员当前学习的课程
            if (isStudy)
            {
                Extend.LoginState.Accounts.Course(course);
            }
            //当前章节
            Song.Entities.Outline ol = olid < 1 ?
                                       Business.Do <IOutline>().OutlineFirst(couid, true)
                : Business.Do <IOutline>().OutlineSingle(olid);
            if (ol == null)
            {
                return;
            }
            this.Document.Variables.SetValue("outline", ol);
            this.Document.Variables.SetValue("olid", ol.Ol_ID.ToString());
            //入写章节id的cookie,当播放视频时会判断此处
            Response.Cookies.Add(new HttpCookie("olid", ol.Ol_ID.ToString()));
            //是否可以学习,如果是免费或已经选修便可以学习,否则当前课程允许试用且当前章节是免费的,也可以学习
            bool canStudy = isBuy || (isStudy && ol.Ol_IsUse && ol.Ol_IsFinish && course.Cou_IsTry && ol.Ol_IsFree);

            this.Document.Variables.SetValue("canStudy", canStudy);

            #region 章节输出
            // 当前课程的所有章节
            Song.Entities.Outline[] outlines = Business.Do <IOutline>().OutlineAll(ol.Cou_ID, true);
            //课程章节列表
            this.Document.Variables.SetValue("outlines", outlines);
            //树形章节输出
            if (outlines.Length > 0)
            {
                this.Document.Variables.SetValue("olTree", Business.Do <IOutline>().OutlineTree(outlines));
            }
            #endregion

            //视频
            Song.Entities.Accessory video = Song.Site.CourseStudy.getVideo(ol.Ol_UID);
            this.Document.Variables.SetValue("video", video);
            if (Extend.LoginState.Accounts.IsLogin)
            {
                Song.Entities.LogForStudentStudy studyLog = Business.Do <IStudent>().LogForStudySingle(this.Account.Ac_ID, ol.Ol_ID);
                if (studyLog != null)
                {
                    this.Document.Variables.SetValue("studyLog", studyLog);
                    double historyPlay = (double)studyLog.Lss_PlayTime / 1000;
                    this.Document.Variables.SetValue("historyPlay", historyPlay);
                }
            }
            //附件
            List <Song.Entities.Accessory> access = Business.Do <IAccessory>().GetAll(ol.Ol_UID, "Course");
            if (access.Count > 0)
            {
                foreach (Accessory ac in access)
                {
                    ac.As_FileName = Upload.Get["Course"].Virtual + ac.As_FileName;
                }
                this.Document.Variables.SetValue("access", access);
            }
        }
        protected override void InitPageTemplate(HttpContext context)
        {
            this.Document.SetValue("couid", couid);
            //当前课程
            Song.Entities.Course course = Business.Do <ICourse>().CourseSingle(couid);
            if (course == null)
            {
                return;
            }
            if (course != null)
            {
                //是否免费,或是限时免费
                if (course.Cou_IsLimitFree)
                {
                    DateTime freeEnd = course.Cou_FreeEnd.AddDays(1).Date;
                    if (!(course.Cou_FreeStart <= DateTime.Now && freeEnd >= DateTime.Now))
                    {
                        course.Cou_IsLimitFree = false;
                    }
                }
                this.Document.SetValue("course", course);
                //当前课程下的章节
                Song.Entities.Outline[] outlines = Business.Do <IOutline>().OutlineAll(couid, true);
                //foreach (Song.Entities.Outline c in outlines)
                //    c.Ol_Intro = Extend.Html.ClearHTML(c.Ol_Intro);
                this.Document.SetValue("outlines", outlines);
                if (outlines != null && outlines.Length > 0)
                {
                    this.Document.Variables.SetValue("dtOutlines", Business.Do <IOutline>().OutlineTree(outlines));
                }
            }
            //是否学习当前课程
            int accid = 0;

            if (Extend.LoginState.Accounts.IsLogin)
            {
                accid = this.Account.Ac_ID;
                bool isStudy = Business.Do <ICourse>().StudyIsCourse(accid, couid);
                this.Document.Variables.SetValue("isStudy", isStudy);
                //当前章节
                Song.Entities.Outline ol = null;
                ol = olid < 1 ? Business.Do <IOutline>().OutlineFirst(couid, true)
                           : ol = Business.Do <IOutline>().OutlineSingle(olid);
                if (ol == null)
                {
                    return;
                }
                //是否可以学习,如果是免费或已经选修便可以学习,否则当前课程允许试用且当前章节是免费的,也可以学习
                bool canStudy = isStudy || course.Cou_IsFree || course.Cou_IsLimitFree ? true : (course.Cou_IsTry && ol.Ol_IsFree);
                canStudy = canStudy && ol.Ol_IsUse && ol.Ol_IsFinish && this.Account != null;
                this.Document.Variables.SetValue("canStudy", canStudy);
                this.Document.Variables.SetValue("outline", ol);
                if (!canStudy)
                {
                    return;
                }
                if (ol == null)
                {
                    return;
                }
                //入写章节id的cookie,当播放视频时会判断此处
                Response.Cookies.Add(new HttpCookie("olid", ol.Ol_ID.ToString()));
                //自定义配置项
                Song.Entities.Organization org    = Business.Do <IOrganization>().OrganCurrent();
                WeiSha.Common.CustomConfig config = CustomConfig.Load(org.Org_Config);
                //视频
                List <Song.Entities.Accessory> videos = Business.Do <IAccessory>().GetAll(ol.Ol_UID, "CourseVideo");
                if (videos.Count > 0)
                {
                    if (videos[0].As_IsOuter)
                    {
                        //如果是外部链接
                        this.Document.Variables.SetValue("video", videos[0]);
                    }
                    else
                    {
                        //如果是内部链接
                        videos[0].As_FileName = Upload.Get[videos[0].As_Type].Virtual + videos[0].As_FileName;
                        this.Document.Variables.SetValue("video", videos[0]);
                        if (Extend.LoginState.Accounts.IsLogin)
                        {
                            Song.Entities.LogForStudentStudy studyLog = Business.Do <IStudent>().LogForStudySingle(this.Account.Ac_ID, ol.Ol_ID);
                            if (studyLog != null)
                            {
                                this.Document.Variables.SetValue("studyLog", studyLog);
                                double historyPlay = (double)studyLog.Lss_PlayTime / 1000;
                                this.Document.Variables.SetValue("historyPlay", historyPlay);
                            }
                        }
                    }
                    this.Document.Variables.SetValue("vpath", Upload.Get["CourseVideo"].Virtual);
                    this.Document.Variables.SetValue("IsVideoNoload", config["IsVideoNoload"].Value.Boolean ?? false);
                }
                //附件
                List <Song.Entities.Accessory> access = Business.Do <IAccessory>().GetAll(ol.Ol_UID, "Course");
                if (access.Count > 0)
                {
                    foreach (Accessory ac in access)
                    {
                        ac.As_FileName = Upload.Get["Course"].Virtual + ac.As_FileName;
                    }
                    this.Document.Variables.SetValue("access", access);
                }
                //章节事件
                OutlineEvent[] events = Business.Do <IOutline>().EventAll(-1, ol.Ol_ID, -1, true);
                this.Document.Variables.SetValue("events", events);
                this.Document.RegisterGlobalFunction(this.getEventQues);
                this.Document.RegisterGlobalFunction(this.getEventFeedback);
                this.Document.RegisterGlobalFunction(this.GetOrder);
            }
        }