Browse Source

增加mac认证地址

sophieChenyx 6 years ago
parent
commit
521e5e8242
2 changed files with 15 additions and 2 deletions
  1. 9 2
      src/util/API/APIClient.js
  2. 6 0
      src/util/WinBoxAPI.js

+ 9 - 2
src/util/API/APIClient.js

@@ -1,6 +1,7 @@
 import Consts from '../Consts';
 import AJAXHelper from './AJAXHelper';
 import userDataStorage from '../userDataStorage';
+import WinBoxAPI from '../WinBoxAPI';
 import Utils from '../Utils';
 
 class APIClient {
@@ -96,8 +97,12 @@ class APIClient {
 
 	// 根据课程获取课列表
 	static getLessonList(courseId, callback) {
+		let macUrl = '';
+		WinBoxAPI.getMacUrl( (res) => {
+			macUrl = res;
+		} )
 		let params = APIClient.addCacheParam({});
-		AJAXHelper.get(`/course/${courseId}/lessons`, params, callback);
+		AJAXHelper.get(`/course/${courseId}/lessons`, { params, mac: macUrl}, callback);
 	}
 
 	// 获取课程详情
@@ -178,8 +183,10 @@ class APIClient {
 
 	// 获取用户的下载记录
 	static getUserDownloadList(callback) {
-		AJAXHelper.get('/callback/download/list', {}, callback);
+    let params = { mac: WinBoxAPI.getMacUrl()}
+		AJAXHelper.get('/callback/download/list', { params }, callback);
 	}
+
 }
 
 module.exports = APIClient;

+ 6 - 0
src/util/WinBoxAPI.js

@@ -47,6 +47,12 @@ class WinBoxAPI {
     WinBoxAPI.get(path, params, callback);
   }
 
+  //获取mac地址
+  static getMacUrl(callback) {
+    let path = '/lesson/getMac';
+    WinBoxAPI.get(path, {}, callback);
+  }
+
   static deleteDownloadFile(lessonId, courseId, callback) {
 		const { token = '', uid = '', eid = '' } = userDataStorage.getData() || {};
     let path = '/lesson/delFile';