/** * 视频信息 */ public function getVideo($videoId) { $tblVideo = new DB_Haodu_CourseVideo(); $video = $tblVideo->fetchRow($videoId); if ($video) { $video['url'] = Common_Config::getVideoUrl($videoId); $video['image'] = Common_Config::getVideoImageUrl($video['image']); $video['duration_fmt'] = sprintf("%'.02d", floor($video['duration'] / 60)) . ":" . sprintf("%'.02d", $video['duration'] % 60); $video['comment_num'] = $this->getVideoCommentNum($video['id']); return $video; } return false; }
/** * 错题解析 */ function wrongAction() { $seq = (int) $this->get('seq', 0); $practiseModel = new PractiseModel(); $uPractise = $practiseModel->getUserPractiseReport($this->uid, $this->sectionId); $wrongSeqList = $practiseModel->getUserWrongPractise($this->uid, $this->sectionId); //需要验证是否有错题 if (!$wrongSeqList) { $this->redirect("/error/?errno=" . Common_Error::ERROR_PRACTISE_NO_WRONG_PARSE); } $seq = $seq == 0 ? $wrongSeqList[0] : $seq; $practise = $practiseModel->getPractiseBySeq($this->sectionId, $seq); $tree = $practise['nested_node_tree']; $data = array("subject_id" => $practise["item_id"], "subject_title" => $tree["node_content"], "subject_seq" => $seq, "answer" => $practise['answer'], "parse" => $practise['parse'], 'video_id' => $practise['video_id'], "create_time_fmt" => $uPractise["create_time_fmt"], "spend_time_fmt" => $uPractise["spend_time_fmt"]); foreach ($wrongSeqList as $wrong) { $data['wrong_practise_seq_list'][] = $wrong['seq']; } //上一题下一题 $index = array_search($seq, $wrongSeqList); $prev = $index - 1; $next = $index + 1; if ($prev >= 0 && isset($wrongSeqList[$prev])) { $data['prev_seq'] = $wrongSeqList[$prev]; } if (isset($wrongSeqList[$next])) { $data['next_seq'] = $wrongSeqList[$next]; } $practiseNum = $practiseModel->getSectionPractiseNum($this->sectionId); $data["subject_num"] = $practiseNum; $data["section_id"] = $this->sectionId; $data["video_url"] = Common_Config::getVideoUrl($this->section['video_id']); foreach ($tree['nested_node_children'] as $option) { $letter = chr(320 + $option["node_index"]); $data['option_list'][] = array("id" => $option["node_index"], "letter_seq" => $letter, "content" => $option["node_content"]); } $statistic = $practiseModel->getPractiseStatistic($this->uid, $practise['item_id'], $this->sectionId); $data = array_merge($statistic, $data); if ($this->ajax) { $this->displayJson(Common_Error::ERROR_SUCCESS, $data); } $this->assign("practise", $data); $this->assign("section", $this->section); $this->assign("course", $this->course); if ($this->platform == 'ios' || $this->platform == 'android') { $this->getView()->display("practise/wrong-app.phtml"); exit; } }