Ejemplo n.º 1
0
 public function getMaxOnlineAction(Request $request)
 {
     $conditions = $request->query->all();
     if (!empty($conditions['courseId']) && !empty($conditions['lessonId'])) {
         $lesson = $this->getCourseService()->getCourseLesson($conditions['courseId'], $conditions['lessonId']);
         $client = new EdusohoLiveClient();
         if ($lesson['type'] == 'live') {
             $result = $client->getMaxOnline($lesson['mediaId']);
             $lesson = $this->getCourseService()->setCourseLessonMaxOnlineNum($lesson['id'], $result['onLineNum']);
         }
     }
     return $this->createJsonResponse($lesson);
 }
Ejemplo n.º 2
0
 public function replayCreateAction(Request $request, $courseId, $lessonId)
 {
     $course = $this->getCourseService()->tryManageCourse($courseId);
     $resultList = $this->getCourseService()->generateLessonReplay($courseId, $lessonId);
     if (array_key_exists("error", $resultList)) {
         return $this->createJsonResponse($resultList);
     }
     $lesson = $this->getCourseService()->getCourseLesson($courseId, $lessonId);
     $lesson["isEnd"] = intval(time() - $lesson["endTime"]) > 0;
     $client = new EdusohoLiveClient();
     if ($lesson['type'] == 'live') {
         $result = $client->getMaxOnline($lesson['mediaId']);
         $this->getCourseService()->setCourseLessonMaxOnlineNum($lesson['id'], $result['onLineNum']);
     }
     return $this->render('TopxiaWebBundle:LiveCourseReplayManage:list-item.html.twig', array('course' => $this->getCourseService()->getCourse($courseId), 'lesson' => $lesson));
 }