var request = require('request'); var cryptoJS = require("crypto-js"); var httpStr = "https://web-winapp.lingjiao.cn"; var mac = require('getmac');//获取mac地址 var macAddressStr = ""; //获取机器mac地址 mac.getMac(function(err,macAddress){ if (err) throw err; macAddressStr = macAddress; //获取mac地址 }); /** * The helper of api */ class LjApiHelper { /** * Gets the API for query course * @param lessonId the lesson id * @param courseId the course id * @param eid the eid * @returns {string} the API url */ static getApiForGetMac() { return macAddressStr; } /** * Gets the API for query course * @param lessonId the lesson id * @param courseId the course id * @param eid the eid * @returns {string} the API url */ static getApiForQueryCourse(lessonId, courseId, eid) { var http = httpStr+"/lesson/" + lessonId; http += "?courseId=" + courseId http += "&eid=" + eid http += "&cache=true"; return http; } /** * Gets the API for add download * @param lessonId the lesson id * @param data the data * @returns {string} */ static getApiForAddDownload(lessonId,courseId,resTotal,data) { return httpStr+"/callback/download/add?lessonId=" + lessonId+"&courseId="+courseId+"&resTotal="+resTotal+"&resSize=0&mac="+macAddressStr; } /** * Gets the API for delete download * @param lessonId the lesson id * @param data the data * @returns {string} */ static getApiForDelDownload(lessonId,data) { return httpStr+"/callback/download/delete?lessonId=" + lessonId+"&mac="+macAddressStr; } /** * Gets the API for update resource size * @param lessonId the lesson id * @returns {string} */ static getApiForUpdateResSize(lessonId) { return httpStr+"/callback/download/update/resource/size?lessonId=" + lessonId+"&mac="+macAddressStr; } } module.exports = LjApiHelper;