var fs = require('fs'); var logHelper = require("./helper/LjLogHelper.js"); var fileHelper = require("./helper/LjFileHelper"); /** * The course down */ class CourseDown { static downCourse(lessonJsonObj,callBack) { /*课件-Begin*/ //课程集合 var courseList = lessonJsonObj.data.list; //课程数 var courseListSize = courseList.length; //遍历课件 for (var i = 0; i < courseListSize; i++) { logHelper.debug(courseList[i].title); //资源集合 var resourceList = courseList[i].list; //资源数 var resourceSize = resourceList.length; for (var j = 0; j < resourceSize; j++) { logHelper.debug(resourceList[j].url); var url = resourceList[j].url; fileHelper.downloadFile(url) } } /*课件-End*/ logHelper.info("Succeed to down lesson【"+lessonJsonObj.data.title+"】"); callBack(); } } module.exports = CourseDown;