123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- 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 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 = "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+"&mac="+macAddressStr;
- }
- /**
- * 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+"&mac="+macAddressStr;
- }
- }
- module.exports = LjApiHelper;
|