public function getRemoteCateAction()
 {
     $player = new PolyvVideo();
     $data = $player->getCate();
     $jsonData = $this->getCategoryService()->makeTree($data['data']);
     return $this->createJsonResponse($jsonData);
 }
 public function importCoursesAction(Request $request)
 {
     $player = new PolyvVideo();
     $data = $player->getCate();
     //远程获取课程目录
     $conditons = array();
     $currentUser = $this->getCurrentUser();
     $conditons['userId'] = $currentUser['id'];
     $myCourses = $this->getCourseService()->findUserTeachCourses($conditons, 0, 99, false);
     $course = array();
     if (empty($data['error'])) {
         foreach ($data['data'] as $key => $remoteCourse) {
             if (in_array($remoteCourse['catatree'], ArrayToolkit::column($myCourses, 'catetree'))) {
                 continue;
             }
             $course['title'] = $remoteCourse["cataname"];
             $course['type'] = "normal";
             $course['catetree'] = $remoteCourse["catatree"];
             $returnCourse = $this->getCourseService()->createCourse($course);
             $Lessons = $player->getNewList($returnCourse["catetree"]);
             $Lessons = json_decode($Lessons, true);
             if ($Lessons['total'] > 0) {
                 $Lessons = array_reverse($Lessons['data']);
                 foreach ($Lessons as $key => $lesson) {
                     $lessonFilt = ArrayToolkit::parts($lesson, array('title', 'duration', 'vid', 'first_image'));
                     $lessonFilt['type'] = "video";
                     $lessonFilt['courseId'] = $returnCourse['id'];
                     $lesson = $this->getCourseService()->createLesson($lessonFilt);
                 }
             }
         }
     }
     $response = array('success' => true, 'message' => "导入成功");
     return $this->createJsonResponse($response);
 }