ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# 微课资源 ## 专题播放页 @url repositories/play/course&courseID=2144550 ``` /** * 专题播放页面 * @author wuzhc 2015-08-17 */ public function actionCourse(){ $courseID = (int)RequestUtils::getNormalRequest('courseID'); $weikeID = (int)RequestUtils::getNormalRequest('weikeID'); $userID = Yii::app()->user->id; //过滤数据 add by wuzhc 2016-02-18 if($courseID == 975778 || $courseID == 975474) { if(BrowserUtils::isMobile()) { echo header('location:http://xuetang.cnweike.cn/dl/xuetang.php'); Yii::app()->end(); } } $this->verifyLogin(); $url = $this->createUrl('/repositories/default/index'); //资源不存在时的跳转链接 if(!$courseID){ $this->redirect_msgBox($url, array('msg' => '参数错误','time'=>1000)); } //专题内容即对应微课内容 $contentArr = V2CourseService::factory()->getCourseWeikes($courseID,1); //2144550 $subjectDetails = $contentArr['content']; if(!$subjectDetails || $subjectDetails->fdDisabled == 1){ $this->redirect_msgBox($url, array('msg' => '该内容已经被删除','time'=>1000)); } if($subjectDetails->users->id != $userID){ if($subjectDetails->mainContribute->fdStatus==0 || $subjectDetails->mainContribute->fdStatus==2){ $this->redirect_msgBox($url, array('msg'=>'该内容未审核或者审核不通过! ','time'=>1000)); } } //当前的微课内容 $weikeData = CourseUtils::selectWeike($contentArr, $weikeID) ; $weike = $weikeData['weike'] ; if(!$weike || $weike->fdDisabled == 1) { $this->redirect_msgBox($url, array('msg' => '该内容已经被删除','time'=>1000)); } //当前内容(微课)的附件 $attachmentFiles = WeikeService::factory()->getAttachmentFiles($weike->id); //播放次数+1 $this->_getContentService()->updateIntegerValue($weike->id, Yii::app()->params['VIDEO_PLAY_TOTAL']); //更新微课播放次数 //对应专题播放次数+1 $this->_getContentService()->updateIntegerValue($courseID,Yii::app()->params['VIDEO_PLAY_TOTAL']); //更新专题播放次数 //获取知识点、章节信息 $Relevance = ExerciseService::factory()->getRelevance($courseID); $knowleges = $Relevance['knows']; //知识点 $section['edtion'] = $Relevance['edtion'];//获取章节信息 //获取辅材信息 $section['auxiliary'] = V2WeikeService::factory()->getSection($courseID); //标签 $tagsInfo = ''; if($subjectDetails->tags && is_array($subjectDetails->tags)){ foreach ($subjectDetails->tags as $tag){ $tagsInfo .= $tag->fdValue.' ' ; } } $tags = WeikeService::factory()->getTag($weike->id); //获取视频打点标签 json格式 $ext = FileUtils::getExtension($weike->wkfile->fdURL); $presrc = str_replace(".".$ext, ".jpg", $weike->wkfile->fdURL); $weikeID or $weikeID = $weike->id; //第一次打开专题时,weikeID的值为空,默认取值 $weikeCollect = $this->_getContentService()->isFavorite($weikeID,Yii::app()->user->id) ? 1 : 0; //收藏专题下的微课 $subjectCollect = $this->_getContentService()->isFavorite($subjectDetails->id,$userID) ? 1 : 0; //收藏专题 //获取本人评分 $userRank = CommentService::factory()->getUserRank($userID,$weikeID); if($userRank) $rank=$userRank->fdRank/20; //保存播放记录到mango //@link https://tower.im/projects/09c3ae86ed0e48fd94cfafa7a449be64/docs/c47e314633324988afa77bcc21be0df2/ $data = array( 'sourceKey' => Yii::app()->params["APPLICATION_MAP"][WK::WEB_TY_KETANG], 'cid' => $subjectDetails->id, 'ctype' => WK::COURSE_TYPE_ID, 'uid' => $userID ?: 0, 'time' => date('Y-m-d H:i:s',time()), 'type' => 1, 'excluded' => $subjectDetails->fdDisabled, 'client' => json_encode($this->_getClientInfo()), ); $this->render('course/content', array( 'data' => $data, 'tags' => $tags, 'files' => $attachmentFiles, 'presrc' => $presrc , 'weike' => $weike, 'course' => $subjectDetails, 'section' => $section, 'tagsInfo' => $tagsInfo, 'userRank' => $rank, 'contentArr' => $contentArr, 'knowleges' => $knowleges, 'weikeCollect' => $weikeCollect, 'subjectCollect' => $subjectCollect, )) ; } ``` ![](./img/upload/01.png)