1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- var request = require('request');
- var cryptoJS = require("crypto-js");
- 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 getApiForQueryCourse(lessonId, courseId, eid)
- {
- var http = "http://tt-web.api.ai160.com/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 "http://tt-web.api.ai160.com/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 "http://tt-web.api.ai160.com/callback/download/delete?lessonId=" + lessonId+"&data="+data;
- }
- /**
- * Gets the API for update resource size
- * @param lessonId the lesson id
- * @returns {string}
- */
- static getApiForUpdateResSize(lessonId)
- {
- return "http://tt-web.api.ai160.com/callback/download/update/resource/size?lessonId=" + lessonId;
- }
- }
- module.exports = LjApiHelper;
|