李勇

1.调整入会流程(先Sass流程,后MCU连接流程)

2.修改从Sass获取的数据储存
@@ -60,17 +60,17 @@ export default class MessageEntrance extends Emiter { @@ -60,17 +60,17 @@ export default class MessageEntrance extends Emiter {
60 // Sass平台层 60 // Sass平台层
61 _sass = Sass; 61 _sass = Sass;
62 _sass.on('*', (type, data) => this._emit(type, data)); 62 _sass.on('*', (type, data) => this._emit(type, data));
63 - _sass.on(_sass.SUCCESS, this._sassVerifySuccessHandler.bind(this));  
64 - _sass.on(_sass.CLASS_INIT_SUCCESS, this._sassInitSuccessHandler.bind(this));  
65 - _sass.on(_sass.CLASS_GET_CLASS_DETAIL, this._sassGetClassDetailSuccessHandler.bind(this));  
66 - _sass.on(_sass.CLASS_GET_CLASS_PARAM,this._sassGetClassParaSuccessHandler.bind(this));  
67 - _sass.on(_sass.CLASS_SAVE_STATUS_INFO_SUCCESS,this._sassSaveClassStatusInfoSuccessHandler.bind(this));  
68 - _sass.on(_sass.DELETE_DOCUMENT_SUCCESS,this._sassDeleteDocumentSuccess.bind(this)); 63 + _sass.on(_sass.SUCCESS, this._sassJoinSuccessHandler.bind(this));//通过SASS平台验证(密码和MD5)
  64 + _sass.on(_sass.CLASS_INIT_SUCCESS, this._sassInitSuccessHandler.bind(this));//获取会议初始化信息
  65 + _sass.on(_sass.CLASS_GET_CLASS_DETAIL, this._sassGetClassDetailSuccessHandler.bind(this));//获取会议的基本信息
  66 + _sass.on(_sass.CLASS_GET_CLASS_PARAM,this._sassGetClassParamSuccessHandler.bind(this));//获取会议的最全信息和历史保存的数据
  67 + _sass.on(_sass.CLASS_SAVE_STATUS_INFO_SUCCESS,this._sassSaveClassStatusInfoSuccessHandler.bind(this));//保存会议状态信息
  68 + _sass.on(_sass.DELETE_DOCUMENT_SUCCESS,this._sassDeleteDocumentSuccess.bind(this));//sass删除文档成功
69 69
70 // 底层MCU消息层 70 // 底层MCU消息层
71 _mcu = Mcu; 71 _mcu = Mcu;
72 _mcu.on('*', (type, data) => this._emit(type, data)); 72 _mcu.on('*', (type, data) => this._emit(type, data));
73 - _mcu.on(MessageTypes.CLASS_JOIN_SUCCESS, this._joinClassSuccessHandler.bind(this)); 73 + _mcu.on(MessageTypes.CLASS_JOIN_SUCCESS, this._joinClassSuccessHandler.bind(this));//加入MCU会议完成
74 74
75 75
76 // 注册所有应用Ape 76 // 注册所有应用Ape
@@ -158,7 +158,7 @@ export default class MessageEntrance extends Emiter { @@ -158,7 +158,7 @@ export default class MessageEntrance extends Emiter {
158 _doClassClose(_param){ 158 _doClassClose(_param){
159 this._leaveClass(); 159 this._leaveClass();
160 } 160 }
161 - //当前的会议状态信息发生改变 161 + //当前的会议状态信息发生改变,需要保存会议状态到Sass
162 _onClassStatusInfoChange(_param){ 162 _onClassStatusInfoChange(_param){
163 this._sassSaveClassStatusInfo(); 163 this._sassSaveClassStatusInfo();
164 } 164 }
@@ -254,7 +254,7 @@ export default class MessageEntrance extends Emiter { @@ -254,7 +254,7 @@ export default class MessageEntrance extends Emiter {
254 } 254 }
255 255
256 // 通过SASS平台验证 256 // 通过SASS平台验证
257 - _sassVerifySuccessHandler(_data) { 257 + _sassJoinSuccessHandler(_data) {
258 //返回值 258 //返回值
259 /* flag 数值型 无 True:成功 259 /* flag 数值型 无 True:成功
260 Flag:失败 260 Flag:失败
@@ -267,31 +267,80 @@ export default class MessageEntrance extends Emiter { @@ -267,31 +267,80 @@ export default class MessageEntrance extends Emiter {
267 rs 字符串 Rs列表 267 rs 字符串 Rs列表
268 doc 字符串 Doc列表*/ 268 doc 字符串 Doc列表*/
269 269
  270 +/* {
  271 + "record": "112.126.80.182:80",
  272 + "flag": "true",
  273 + "h5Module": 1,
  274 + "maxVideoChannels": 1,
  275 + "mcu": "123.56.73.119:7000;123.56.69.230:7000;112.126.80.182:7000",
  276 + "ms": "pubms.3mang.com:1935",
  277 + "doc": "101.200.150.192:80",
  278 + "rs": "pubms.3mang.com:1935",
  279 + "type": 1,
  280 + "maxAudioChannels": 1,
  281 + "h5_mcu_list": "123.56.73.119:7001;123.56.69.230:7001;112.126.80.182:7001"
  282 + }*/
  283 + if (_data.h5_mcu_list) {
  284 + //MCU地址默认使用第一个
  285 + let server = _data.h5_mcu_list.split(";")[0];
  286 + GlobalConfig.MCUServerIP = server.split(":")[0];
  287 + GlobalConfig.MCUServerPort = server.split(":")[1];
  288 + }
  289 +
270 GlobalConfig.doc=_data.doc; 290 GlobalConfig.doc=_data.doc;
271 GlobalConfig.h5_mcu_list=_data.h5_mcu_list; 291 GlobalConfig.h5_mcu_list=_data.h5_mcu_list;
272 GlobalConfig.h5Module=_data.h5Module; 292 GlobalConfig.h5Module=_data.h5Module;
273 - GlobalConfig.maxAudioChannels=_data.maxAudioChannels;  
274 - GlobalConfig.maxVideoChannels=_data.maxVideoChannels;  
275 GlobalConfig.mcu=_data.mcu; 293 GlobalConfig.mcu=_data.mcu;
276 GlobalConfig.ms=_data.ms; 294 GlobalConfig.ms=_data.ms;
277 GlobalConfig.record=_data.record; 295 GlobalConfig.record=_data.record;
278 GlobalConfig.rs=_data.rs; 296 GlobalConfig.rs=_data.rs;
  297 + GlobalConfig.maxVideoChannels=_data.maxVideoChannels;
  298 + GlobalConfig.maxAudioChannels=_data.maxAudioChannels;
  299 + GlobalConfig.maxMediaChannels= _data.maxVideoChannels + _data.maxAudioChannels;
279 300
280 -  
281 - loger.log('加入底层MCU会议.');  
282 - if(_mcu){  
283 - _mcu.joinMCU(GlobalConfig.getClassInfo()); 301 + if(_sass){
  302 + _sass.getClassDetail();//会议基本信息
284 } 303 }
285 } 304 }
286 305
287 //获取会议所有参数 getClassH5 306 //获取会议所有参数 getClassH5
288 _sassGetClassDetailSuccessHandler(_data){ 307 _sassGetClassDetailSuccessHandler(_data){
289 loger.log('获取getClassDetail完成.'); 308 loger.log('获取getClassDetail完成.');
290 - GlobalConfig.setClassDetail=_data; 309 + /* {
  310 + "cycle": 0,
  311 + "repeatmonthweekweek": 0,
  312 + "status": 1,
  313 + "repeatmonthday": 0,
  314 + "repeatmode": 0,
  315 + "beginTime": "2017-02-03 09:00:00",
  316 + "frequency": 1,
  317 + "endmode": 0,
  318 + "meetingContent": "",
  319 + "endTime": "2017-03-31 11:00:00",
  320 + "repeatweek": "",
  321 + "category": "",
  322 + "finalenddate": "",
  323 + "repeatday": 0,
  324 + "meetingName": "mcu1",
  325 + "errorCode": 0,
  326 + "monthType": 0,
  327 + "repeatmonthweekday": 0,
  328 + "endcount": 1
  329 + }*/
  330 + GlobalConfig.classDetail=_data;
  331 + GlobalConfig.className=_data.meetingName||"";
  332 + GlobalConfig.classBeginTime=_data.beginTime||"";
  333 + GlobalConfig.classEndTime=_data.endTime||"";
  334 +
  335 + //获取会议所有信息和以前保存的会议状态信息
  336 + if(_sass){
  337 + _sass.getClassParam();
  338 + }
291 } 339 }
292 340
293 //获取会议所有参数 api/meeting/detail.do? flash中的接口文件是 getClassParam.do 341 //获取会议所有参数 api/meeting/detail.do? flash中的接口文件是 getClassParam.do
294 - _sassGetClassParaSuccessHandler(_data){ 342 + _sassGetClassParamSuccessHandler(_data){
  343 + //console.log(GlobalConfig.classStatusInfo)
295 loger.log('获取api/meeting/detail.do完成.'); 344 loger.log('获取api/meeting/detail.do完成.');
296 // console.log(_data); 345 // console.log(_data);
297 //包含整个会议最全的信息,储存数据 346 //包含整个会议最全的信息,储存数据
@@ -306,7 +355,6 @@ export default class MessageEntrance extends Emiter { @@ -306,7 +355,6 @@ export default class MessageEntrance extends Emiter {
306 GlobalConfig.setRsList(_data.rsList);// 355 GlobalConfig.setRsList(_data.rsList);//
307 356
308 } 357 }
309 -  
310 if(_data.currentInfo){ 358 if(_data.currentInfo){
311 //根据从Sass获取的数据信息,同步最后一次保存的会议状态信息 359 //根据从Sass获取的数据信息,同步最后一次保存的会议状态信息
312 loger.log("同步最后一次保存过的会议状态信息"); 360 loger.log("同步最后一次保存过的会议状态信息");
@@ -321,11 +369,15 @@ export default class MessageEntrance extends Emiter { @@ -321,11 +369,15 @@ export default class MessageEntrance extends Emiter {
321 loger.log("2222222222222222222222222"); 369 loger.log("2222222222222222222222222");
322 console.log(GlobalConfig.classStatusInfo);*/ 370 console.log(GlobalConfig.classStatusInfo);*/
323 371
324 - console.log(_data.currentInfo);  
325 - GlobalConfig.classStatusInfo=_data.currentInfo; 372 + //console.log(_data.currentInfo);
  373 + GlobalConfig.setClassStatusInfo(_data.currentInfo);
  374 + console.log(GlobalConfig.classStatusInfo)
326 }else { 375 }else {
327 - loger.log("还没有保存过会议状信息"); 376 + loger.log("还没有保存过会议状信息");
328 } 377 }
  378 +
  379 + //所有Sass流程完成,开始MCU连接
  380 + this._joinMCU();
329 } 381 }
330 382
331 //保存会议状态信息 383 //保存会议状态信息
@@ -347,37 +399,17 @@ export default class MessageEntrance extends Emiter { @@ -347,37 +399,17 @@ export default class MessageEntrance extends Emiter {
347 loger.log('保存会议状态信息成功.',_data); 399 loger.log('保存会议状态信息成功.',_data);
348 } 400 }
349 401
  402 + //Sass校验流程结束之后,开始加入MCU
  403 + _joinMCU(){
  404 + loger.log('加入底层MCU会议.');
  405 + if(_mcu){
  406 + _mcu.joinMCU(GlobalConfig.getClassInfo());
  407 + }
  408 + }
350 // MCU 会议成功 409 // MCU 会议成功
351 _joinClassSuccessHandler(_data) { 410 _joinClassSuccessHandler(_data) {
352 loger.log('MCU 会议成功.'); 411 loger.log('MCU 会议成功.');
353 GlobalConfig.setCurrentStatus(GlobalConfig.statusCode_2); 412 GlobalConfig.setCurrentStatus(GlobalConfig.statusCode_2);
354 - if(_sass){  
355 - _sass.getClassDetail();//会议信息  
356 - _sass.getClassParam();//会议参数大全  
357 - }  
358 -  
359 - //储存数据  
360 - GlobalConfig.MCUServerIP=_data.MCUServerIP;  
361 - GlobalConfig.MCUServerPort=_data.MCUServerPort;  
362 - GlobalConfig.classId=_data.classId;  
363 - GlobalConfig.h5Module=_data.h5Module;  
364 - GlobalConfig.maxAudioChannels=_data.maxAudioChannels;  
365 - GlobalConfig.maxVideoChannels=_data.maxVideoChannels;  
366 - GlobalConfig.maxMediaChannels=_data.maxMediaChannels;  
367 - GlobalConfig.mcuClassInfo=_data.mcuClassInfo;  
368 - GlobalConfig.mcuDelay=_data.mcuDelay;  
369 - GlobalConfig.md5=_data.md5;  
370 - GlobalConfig.msType=_data.msType;  
371 - GlobalConfig.nodeId=_data.nodeId;  
372 - GlobalConfig.password=_data.password;  
373 - GlobalConfig.portal=_data.portal;  
374 - GlobalConfig.role=_data.role;  
375 - GlobalConfig.siteId=_data.siteId;  
376 - GlobalConfig.topNodeID=_data.topNodeID;  
377 - GlobalConfig.userId=_data.userId;  
378 - GlobalConfig.userName=_data.userName;  
379 - GlobalConfig.userRole=_data.userRole;  
380 - GlobalConfig.userType=_data.userType;  
381 413
382 //返回给客户数据 414 //返回给客户数据
383 if(_joinClassSuccessCallBackFun){ 415 if(_joinClassSuccessCallBackFun){
@@ -385,7 +417,7 @@ export default class MessageEntrance extends Emiter { @@ -385,7 +417,7 @@ export default class MessageEntrance extends Emiter {
385 let initSuccessCallBackData={}; 417 let initSuccessCallBackData={};
386 418
387 //GlobalConfig.MCUServerIP=_data.MCUServerIP; 419 //GlobalConfig.MCUServerIP=_data.MCUServerIP;
388 - // GlobalConfig.MCUServerPort=_data.MCUServerPort; 420 + // GlobalConfig.MCUServerPort=_data.MCUServerPort;
389 421
390 initSuccessCallBackData.doc=GlobalConfig.doc;//文档服务器地址 422 initSuccessCallBackData.doc=GlobalConfig.doc;//文档服务器地址
391 initSuccessCallBackData.classId=GlobalConfig.classId; 423 initSuccessCallBackData.classId=GlobalConfig.classId;
@@ -420,6 +452,79 @@ export default class MessageEntrance extends Emiter { @@ -420,6 +452,79 @@ export default class MessageEntrance extends Emiter {
420 loger.log('加入会议成功',initSuccessCallBackData); 452 loger.log('加入会议成功',initSuccessCallBackData);
421 _joinClassSuccessCallBackFun(initSuccessCallBackData); 453 _joinClassSuccessCallBackFun(initSuccessCallBackData);
422 } 454 }
  455 +
  456 +
  457 + //loger.log('MCU 会议成功.');
  458 + //GlobalConfig.setCurrentStatus(GlobalConfig.statusCode_2);
  459 + //if(_sass){
  460 + // _sass.getClassDetail();//会议信息
  461 + // _sass.getClassParam();//会议参数大全
  462 + //}
  463 + //
  464 + ////储存数据
  465 + //GlobalConfig.MCUServerIP=_data.MCUServerIP;
  466 + //GlobalConfig.MCUServerPort=_data.MCUServerPort;
  467 + //GlobalConfig.classId=_data.classId;
  468 + //GlobalConfig.h5Module=_data.h5Module;
  469 + //GlobalConfig.maxAudioChannels=_data.maxAudioChannels;
  470 + //GlobalConfig.maxVideoChannels=_data.maxVideoChannels;
  471 + //GlobalConfig.maxMediaChannels=_data.maxMediaChannels;
  472 + //GlobalConfig.mcuClassInfo=_data.mcuClassInfo;
  473 + //GlobalConfig.mcuDelay=_data.mcuDelay;
  474 + //GlobalConfig.md5=_data.md5;
  475 + //GlobalConfig.msType=_data.msType;
  476 + //GlobalConfig.nodeId=_data.nodeId;
  477 + //GlobalConfig.password=_data.password;
  478 + //GlobalConfig.portal=_data.portal;
  479 + //GlobalConfig.role=_data.role;
  480 + //GlobalConfig.siteId=_data.siteId;
  481 + //GlobalConfig.topNodeID=_data.topNodeID;
  482 + //GlobalConfig.userId=_data.userId;
  483 + //GlobalConfig.userName=_data.userName;
  484 + //GlobalConfig.userRole=_data.userRole;
  485 + //GlobalConfig.userType=_data.userType;
  486 + //
  487 + ////返回给客户数据
  488 + //if(_joinClassSuccessCallBackFun){
  489 + // //返回给客户端初始化成功的数据
  490 + // let initSuccessCallBackData={};
  491 + //
  492 + // //GlobalConfig.MCUServerIP=_data.MCUServerIP;
  493 + // // GlobalConfig.MCUServerPort=_data.MCUServerPort;
  494 + //
  495 + // initSuccessCallBackData.doc=GlobalConfig.doc;//文档服务器地址
  496 + // initSuccessCallBackData.classId=GlobalConfig.classId;
  497 + // initSuccessCallBackData.className=GlobalConfig.className;
  498 + // initSuccessCallBackData.h5Module=GlobalConfig.h5Module;
  499 + // initSuccessCallBackData.isHost=GlobalConfig.isHost;
  500 + // initSuccessCallBackData.maxAudioChannels=GlobalConfig.maxAudioChannels;
  501 + // initSuccessCallBackData.maxVideoChannels=GlobalConfig.maxVideoChannels;
  502 + // initSuccessCallBackData.maxMediaChannels=GlobalConfig.maxMediaChannels;
  503 + // initSuccessCallBackData.mcuDelay=GlobalConfig.mcuDelay;
  504 + //
  505 + // initSuccessCallBackData.msType=GlobalConfig.msType;
  506 + // initSuccessCallBackData.nodeId=GlobalConfig.nodeId;
  507 + // initSuccessCallBackData.password=GlobalConfig.password;
  508 + // initSuccessCallBackData.passwordRequired=GlobalConfig.passwordRequired;// 老师的默认是true
  509 + // //GlobalConfig.passwordRequired 老师的默认是true
  510 + // //GlobalConfig.portal=_data.portal;
  511 + // initSuccessCallBackData.role=GlobalConfig.role;
  512 + // initSuccessCallBackData.siteId=GlobalConfig.siteId;
  513 + // initSuccessCallBackData.topNodeID=GlobalConfig.topNodeID;
  514 + // initSuccessCallBackData.userId=GlobalConfig.userId;
  515 + // initSuccessCallBackData.userName=GlobalConfig.userName;
  516 + // initSuccessCallBackData.userRole=GlobalConfig.userRole;
  517 + // initSuccessCallBackData.userType=GlobalConfig.userType;
  518 + //
  519 + // initSuccessCallBackData.siteId=GlobalConfig.siteId;
  520 + // initSuccessCallBackData.classId=GlobalConfig.classId;
  521 + // initSuccessCallBackData.userRole=GlobalConfig.userRole;
  522 + // initSuccessCallBackData.userId=GlobalConfig.userId;
  523 + // initSuccessCallBackData.passwordRequired=GlobalConfig.passwordRequired;
  524 + // initSuccessCallBackData.classType=GlobalConfig.classType||ApeConsts.CLASS_TYPE_INTERACT;
  525 + // loger.log('加入会议成功',initSuccessCallBackData);
  526 + // _joinClassSuccessCallBackFun(initSuccessCallBackData);
  527 + //}
423 } 528 }
424 529
425 //Sass删除文档数据 530 //Sass删除文档数据
@@ -30,33 +30,6 @@ class GlobalConfig { @@ -30,33 +30,6 @@ class GlobalConfig {
30 static getClassDetail(){ 30 static getClassDetail(){
31 return this.classDetail; 31 return this.classDetail;
32 } 32 }
33 - static setClassDetail(_data){  
34 - this.classDetail=_data;  
35 - this.className=_data.meetingName||"";  
36 - this.classBeginTime=_data.beginTime||"";  
37 - this.classEndTime=_data.endTime||"";  
38 - /* {  
39 - "cycle": 0,  
40 - "repeatmonthweekweek": 0,  
41 - "status": 1,  
42 - "repeatmonthday": 0,  
43 - "repeatmode": 0,  
44 - "beginTime": "2017-02-03 09:00:00",  
45 - "frequency": 1,  
46 - "endmode": 0,  
47 - "meetingContent": "",  
48 - "endTime": "2017-03-31 11:00:00",  
49 - "repeatweek": "",  
50 - "category": "",  
51 - "finalenddate": "",  
52 - "repeatday": 0,  
53 - "meetingName": "mcu1",  
54 - "errorCode": 0,  
55 - "monthType": 0,  
56 - "repeatmonthweekday": 0,  
57 - "endcount": 1  
58 - }*/  
59 - }  
60 33
61 static getClassInfo (){ 34 static getClassInfo (){
62 let classInfo={}; 35 let classInfo={};
@@ -116,7 +89,8 @@ class GlobalConfig { @@ -116,7 +89,8 @@ class GlobalConfig {
116 return classStatusInfo; 89 return classStatusInfo;
117 } 90 }
118 //设置当前的课堂状态的信息 91 //设置当前的课堂状态的信息
119 - static set classStatusInfo(_data){ 92 + static setClassStatusInfo(_data){
  93 + loger.log("setClassStatusInfo");
120 if(_data==null){ 94 if(_data==null){
121 loger.warn("classStatusInfo error,_data:",_data); 95 loger.warn("classStatusInfo error,_data:",_data);
122 return; 96 return;
@@ -130,6 +104,7 @@ class GlobalConfig { @@ -130,6 +104,7 @@ class GlobalConfig {
130 this.classType=data.classType||this.classType;//课堂类型 104 this.classType=data.classType||this.classType;//课堂类型
131 this.classStatus=data.classStatus||this.classStatus;//课堂的状态 105 this.classStatus=data.classStatus||this.classStatus;//课堂的状态
132 this.classStartTime=data.classStartTime||this.classStartTime;//课堂点击开始时间 106 this.classStartTime=data.classStartTime||this.classStartTime;//课堂点击开始时间
  107 +
133 this.classStopTime=data.classStopTime||this.classStopTime;//最后一次停止的时间(点暂停或结束),每次发送数据都获取当前时间戳 108 this.classStopTime=data.classStopTime||this.classStopTime;//最后一次停止的时间(点暂停或结束),每次发送数据都获取当前时间戳
134 this.classTimestamp=data.classTimestamp||this.classTimestamp;//相对于点开始课堂的时间戳 109 this.classTimestamp=data.classTimestamp||this.classTimestamp;//相对于点开始课堂的时间戳
135 110
@@ -314,7 +289,7 @@ GlobalConfig.classTimestamp=0;//从课堂开始到现在的时 @@ -314,7 +289,7 @@ GlobalConfig.classTimestamp=0;//从课堂开始到现在的时
314 GlobalConfig.recordStatus=false;//当前录制状态 289 GlobalConfig.recordStatus=false;//当前录制状态
315 GlobalConfig.recordTimestamp=0;//相对于首次开始录制的进行时间 290 GlobalConfig.recordTimestamp=0;//相对于首次开始录制的进行时间
316 GlobalConfig.recordFileName="";//录制的文件名 291 GlobalConfig.recordFileName="";//录制的文件名
317 -GlobalConfig.recordDownloadUrl="xxxxxxxxxxxxxxxxxxxxx";//下载地址 292 +GlobalConfig.recordDownloadUrl="";//下载地址
318 GlobalConfig.recordReplaytickValues={}; // 滚动条关键点,用于快进快退 293 GlobalConfig.recordReplaytickValues={}; // 滚动条关键点,用于快进快退
319 294
320 //GlobalConfig.serverTimestamp=0;//当前的系统时间戳 用get set 获取 295 //GlobalConfig.serverTimestamp=0;//当前的系统时间戳 用get set 获取
@@ -162,7 +162,7 @@ class Sass extends Emiter { @@ -162,7 +162,7 @@ class Sass extends Emiter {
162 }) 162 })
163 .then(ret => { 163 .then(ret => {
164 if (ret.flag == "true"||ret.flag == true) { 164 if (ret.flag == "true"||ret.flag == true) {
165 - if (ret.h5_mcu_list) { 165 + /* if (ret.h5_mcu_list) {
166 let server = ret.h5_mcu_list.split(";")[0]; 166 let server = ret.h5_mcu_list.split(";")[0];
167 confInfo.MCUServerIP = server.split(":")[0]; 167 confInfo.MCUServerIP = server.split(":")[0];
168 confInfo.MCUServerPort = server.split(":")[1]; 168 confInfo.MCUServerPort = server.split(":")[1];
@@ -176,8 +176,8 @@ class Sass extends Emiter { @@ -176,8 +176,8 @@ class Sass extends Emiter {
176 176
177 GlobalConfig.maxVideoChannels=confInfo.maxVideoChannels; 177 GlobalConfig.maxVideoChannels=confInfo.maxVideoChannels;
178 GlobalConfig.maxAudioChannels=confInfo.maxAudioChannels; 178 GlobalConfig.maxAudioChannels=confInfo.maxAudioChannels;
179 - GlobalConfig.maxMediaChannels=confInfo.maxMediaChannels;  
180 - loger.log('校验完成',ret); 179 + GlobalConfig.maxMediaChannels=confInfo.maxMediaChannels;*/
  180 + loger.log('MD5校验完成',ret);
181 this._emit(Sass.SUCCESS,ret); 181 this._emit(Sass.SUCCESS,ret);
182 } else { 182 } else {
183 loger.log('MD5校验-失败.'); 183 loger.log('MD5校验-失败.');
@@ -15,11 +15,11 @@ let loger = Loger.getLoger('ConferApe'); @@ -15,11 +15,11 @@ let loger = Loger.getLoger('ConferApe');
15 let itemIdx=0;//table插入新数据的计数id,目前用时间戳 15 let itemIdx=0;//table插入新数据的计数id,目前用时间戳
16 let timerCounter; 16 let timerCounter;
17 17
18 -const ACTION_TYPE_0=0;  
19 -const ACTION_TYPE_1=1;  
20 -const ACTION_TYPE_2=2;  
21 -const ACTION_TYPE_3=3;  
22 -const ACTION_TYPE_4=4; 18 +//const ACTION_TYPE_0=0;
  19 +//const ACTION_TYPE_1=1;
  20 +//const ACTION_TYPE_2=2;
  21 +//const ACTION_TYPE_3=3;
  22 +//const ACTION_TYPE_4=4;
23 class ConferApe extends Ape { 23 class ConferApe extends Ape {
24 constructor() { 24 constructor() {
25 super( 25 super(
@@ -59,6 +59,7 @@ class ConferApe extends Ape { @@ -59,6 +59,7 @@ class ConferApe extends Ape {
59 59
60 } 60 }
61 61
  62 +
62 //加入会议 63 //加入会议
63 _joinSessionHandler(_data) { 64 _joinSessionHandler(_data) {
64 let nodeInfoRecordPdu = this.mcu.mcuClassInfo.self; 65 let nodeInfoRecordPdu = this.mcu.mcuClassInfo.self;
@@ -134,47 +135,50 @@ class ConferApe extends Ape { @@ -134,47 +135,50 @@ class ConferApe extends Ape {
134 135
135 //开始上课 136 //开始上课
136 startClass(_param){ 137 startClass(_param){
  138 + let timestamp=EngineUtils.creatTimestampStr();
  139 + GlobalConfig.classStopTime=timestamp;
  140 +
137 if(GlobalConfig.classStatus==ApeConsts.CLASS_STATUS_WAIT){ 141 if(GlobalConfig.classStatus==ApeConsts.CLASS_STATUS_WAIT){
138 - GlobalConfig.classStartTime=EngineUtils.creatTimestampStr();  
139 - GlobalConfig.classStopTime=GlobalConfig.classStartTime;  
140 - }else{  
141 - GlobalConfig.classStopTime=GlobalConfig.creatTimestampStr; 142 + GlobalConfig.classStartTime=timestamp;
142 } 143 }
143 144
144 GlobalConfig.classStatus=ApeConsts.CLASS_STATUS_STARTED; 145 GlobalConfig.classStatus=ApeConsts.CLASS_STATUS_STARTED;
145 - _param.actionType=ACTION_TYPE_1; 146 + //_param.actionType=ACTION_TYPE_1;
146 this._emit(MessageTypes.CLASS_STATUS_INFO_CHANGE); 147 this._emit(MessageTypes.CLASS_STATUS_INFO_CHANGE);
147 this.sendUpdaterClassStatusInfo(_param); 148 this.sendUpdaterClassStatusInfo(_param);
148 } 149 }
149 //暂停上课 150 //暂停上课
150 pauseClass(_param){ 151 pauseClass(_param){
  152 + if(GlobalConfig.classStatus==ApeConsts.CLASS_STATUS_WAIT){
  153 + loger.warn('还没有开始,不能点暂停');
  154 + return;
  155 + }
  156 +
151 GlobalConfig.classStatus=ApeConsts.CLASS_STATUS_PAUSE; 157 GlobalConfig.classStatus=ApeConsts.CLASS_STATUS_PAUSE;
152 GlobalConfig.classStopTime=EngineUtils.creatTimestampStr(); 158 GlobalConfig.classStopTime=EngineUtils.creatTimestampStr();
153 - _param.actionType=ACTION_TYPE_2; 159 + //_param.actionType=ACTION_TYPE_2;
154 this._emit(MessageTypes.CLASS_STATUS_INFO_CHANGE); 160 this._emit(MessageTypes.CLASS_STATUS_INFO_CHANGE);
155 this.sendUpdaterClassStatusInfo(_param); 161 this.sendUpdaterClassStatusInfo(_param);
156 } 162 }
157 //关闭课堂 163 //关闭课堂
158 closeClass(_param){ 164 closeClass(_param){
  165 + if(GlobalConfig.classStatus==ApeConsts.CLASS_STATUS_WAIT){
  166 + loger.warn('还没有开始,不能点关闭');
  167 + return;
  168 + }
  169 +
159 //把所有人都踢出课堂,然后把状态值还原为1 170 //把所有人都踢出课堂,然后把状态值还原为1
160 GlobalConfig.classStatus=ApeConsts.CLASS_STATUS_WAIT;// 171 GlobalConfig.classStatus=ApeConsts.CLASS_STATUS_WAIT;//
161 GlobalConfig.classStopTime=EngineUtils.creatTimestampStr(); 172 GlobalConfig.classStopTime=EngineUtils.creatTimestampStr();
162 - _param.actionType=ACTION_TYPE_3; 173 + //_param.actionType=ACTION_TYPE_3;
163 this._emit(MessageTypes.CLASS_STATUS_INFO_CHANGE); 174 this._emit(MessageTypes.CLASS_STATUS_INFO_CHANGE);
164 this.sendUpdaterClassStatusInfo(_param); 175 this.sendUpdaterClassStatusInfo(_param);
165 -  
166 } 176 }
167 177
168 - //更新课堂状态  
169 - updateClassStatus(_param){  
170 - //GlobalConfig.classStatus=ApeConsts.CLASS_STATUS_UPTATE;  
171 - //_param.actionType=ACTION_TYPE_4;  
172 - //this.sendUpdaterClassStatusInfo(_param);  
173 - }  
174 178
175 //更新会议信息 179 //更新会议信息
176 sendUpdaterClassStatusInfo(_param){ 180 sendUpdaterClassStatusInfo(_param){
177 - loger.log('sendUpdaterClassStatusInfo----------'); 181 + loger.log('sendUpdaterClassStatusInfo---1-------');
178 if(_param==null||EngineUtils.isEmptyObject(_param)){ 182 if(_param==null||EngineUtils.isEmptyObject(_param)){
179 loger.log('sendUpdaterClassStatusInfo,参数错误'); 183 loger.log('sendUpdaterClassStatusInfo,参数错误');
180 this._emit(MessageTypes.MCU_ERROR,MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG); 184 this._emit(MessageTypes.MCU_ERROR,MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG);
@@ -182,7 +186,8 @@ class ConferApe extends Ape { @@ -182,7 +186,8 @@ class ConferApe extends Ape {
182 } 186 }
183 itemIdx=ApeConsts.CONFERENCE_OBJ_TABLE_ID;// itemIdx=_param.itemIdx; 187 itemIdx=ApeConsts.CONFERENCE_OBJ_TABLE_ID;// itemIdx=_param.itemIdx;
184 let modelPdu = this.packPdu(_param,itemIdx); 188 let modelPdu = this.packPdu(_param,itemIdx);
185 - //console.log(modelPdu); 189 + loger.log('sendUpdaterClassStatusInfo----2------');
  190 + console.log(modelPdu);
186 191
187 if(modelPdu==null){ 192 if(modelPdu==null){
188 loger.log('sendUpdaterClassStatusInfo,参数错误'); 193 loger.log('sendUpdaterClassStatusInfo,参数错误');
@@ -274,121 +279,33 @@ class ConferApe extends Ape { @@ -274,121 +279,33 @@ class ConferApe extends Ape {
274 this.sendUniform(adapterPdu,true); 279 this.sendUniform(adapterPdu,true);
275 }*/ 280 }*/
276 281
277 - ///////白板数据的封包和解包/////////////////////////////////////////  
278 - packPdu(_param,_itemIdx){  
279 - loger.log("会议===packPdu ");  
280 - //验证坐标点集合数组是否合法  
281 - if(_param==null||_itemIdx==null){  
282 - this._emit(MessageTypes.MCU_ERROR,MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG);  
283 - return null;  
284 - }  
285 -  
286 -/* message RCClassStatusInfoPdu {  
287 - optional uint32 node_id=1;//mcu中的唯一ID  
288 - optional uint32 user_id=2;  
289 - optional uint32 user_name=3;  
290 - optional uint32 site_id=4;//站点号  
291 - optional uint32 class_id=5;  
292 - optional uint32 class_name=6;  
293 - required uint32 class_type=7;//课堂类型  
294 - required uint32 class_status=9;//课堂的状态  
295 - optional uint32 class_startTime=10;//课堂点击开始时间  
296 - optional uint32 class_stopTime=11;//最后一次停止的时间(点暂停或结束),每次发送数据都获取当前时间戳  
297 - optional uint32 class_timestamp=12;//相对于点开始课堂的时间戳  
298 - optional uint32 class_beginTime=13;//课堂创建的时间,这个是Sass返回的  
299 - optional uint32 class_endTime=14;//课堂结束的时间,这个是Sass返回的  
300 - optional uint32 record_status=15;//当前录制状态  
301 - optional uint32 record_timestamp=16;//相对于首次开始录制的时间戳  
302 - optional uint32 record_fileName=17;//录制的文件名  
303 - optional uint32 record_downloadUrl=18;//下载地址  
304 - optional uint32 server_timestamp=19;//当前的系统时间戳  
305 - }*/  
306 -  
307 - let classStatusInfo=new pdu['RCClassStatusInfoPdu'];  
308 - classStatusInfo.nodeId=GlobalConfig.nodeId;//mcu中的唯一ID  
309 - classStatusInfo.userId=GlobalConfig.userId;  
310 - classStatusInfo.userName=GlobalConfig.userName;  
311 - classStatusInfo.siteId=GlobalConfig.siteId;//站点号  
312 - classStatusInfo.classId=GlobalConfig.classId;  
313 - classStatusInfo.className=GlobalConfig.className;  
314 - classStatusInfo.classType=GlobalConfig.classType;//课堂类型  
315 - classStatusInfo.classStatus=GlobalConfig.classStatus;//课堂的状态  
316 - classStatusInfo.classStartTime=GlobalConfig.classStartTime;//课堂点击开始时间  
317 - classStatusInfo.classStopTime=GlobalConfig.classStopTime;//最后一次停止的时间(点暂停或结束),每次发送数据都获取当前时间戳  
318 - classStatusInfo.classTimestamp=GlobalConfig.classTimestamp;//相对于点开始课堂的时间戳  
319 - classStatusInfo.classBeginTime=GlobalConfig.classBeginTime;//课堂创建的时间,这个是Sass返回的  
320 - classStatusInfo.classEndTime=GlobalConfig.classEndTime;//课堂结束的时间,这个是Sass返回的  
321 - classStatusInfo.recordStatus=GlobalConfig.recordStatus;//当前录制状态  
322 - classStatusInfo.recordTimestamp=GlobalConfig.recordTimestamp;//相对于首次开始录制的时间戳  
323 - classStatusInfo.recordFileName=GlobalConfig.recordFileName;//录制的文件名  
324 - classStatusInfo.recordDownloadUrl=GlobalConfig.recordDownloadUrl;//下载地址  
325 - classStatusInfo.serverTimestamp=GlobalConfig.serverTimestamp;//当前的系统时间戳  
326 - classStatusInfo.activeDocId=GlobalConfig.activeDocId;//当前激活的文档id  
327 - classStatusInfo.activeDocCurPage=GlobalConfig.activeDocCurPage;//当前激活的文档的当前页  
328 -  
329 -  
330 - console.log("classStatusInfo-------------");  
331 - console.log(classStatusInfo);  
332 - /*  
333 - optional uint32 item_idx=1;  
334 - optional uint32 from=2;  
335 - optional uint32 owner=3;  
336 - optional uint32 action_type=4;//状态改变的类型  
337 - optional RCClassStatusInfoPdu class_status_info=5;//当前课堂状态的信息  
338 - */  
339 - //判断type类型,根据type设置不同的参数  
340 - let modelPdu =new pdu['RCClassSendDataModelPdu'];  
341 - modelPdu.itemIdx=_itemIdx;  
342 - modelPdu.from=GlobalConfig.nodeId;  
343 - modelPdu.owner=GlobalConfig.nodeId;  
344 - modelPdu.actionType =_param.actionType;  
345 - modelPdu.classStatusInfo=classStatusInfo;  
346 -  
347 - console.log(modelPdu);  
348 - return modelPdu;  
349 - }  
350 -  
351 - unPackPdu(owner, itemIdx,itemData){  
352 - loger.log("会议===unPackPdu ");  
353 - if(owner==null||itemIdx==null||itemData==null){  
354 - this._emit(MessageTypes.MCU_ERROR,MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG);  
355 - return null;  
356 - }  
357 282
358 - try{  
359 - let modelPdu= pdu['RCClassSendDataModelPdu'].decode(itemData);  
360 - return modelPdu;  
361 - }catch (err){  
362 - loger.log("会议收到数据 unPackPdu Pdu解析错误,itemIdx="+itemIdx+" err:"+err.message);  
363 - }  
364 - return null; 283 + /////收到消息处理/////////////////////////////////////////////////////////////////////////////////
  284 + onJoinChannelHandlerSuccess(){
  285 + loger.log('ConferApe onJoinChannelHandlerSuccess');
  286 + //if(GlobalConfig.isHost){
  287 + // if(GlobalConfig.classStatus==ApeConsts.CLASS_STATUS_WAIT){
  288 + // GlobalConfig.classStartTime=EngineUtils.creatTimestampStr();
  289 + // GlobalConfig.classStopTime=GlobalConfig.classStartTime;
  290 + // }else{
  291 + // GlobalConfig.classStopTime=GlobalConfig.creatTimestampStr;
  292 + // }
  293 + //
  294 + // GlobalConfig.classStatus=ApeConsts.CLASS_STATUS_STARTED;
  295 + // //_param.actionType=ACTION_TYPE_1;
  296 + // this._emit(MessageTypes.CLASS_STATUS_INFO_CHANGE);
  297 + // this.sendUpdaterClassStatusInfo(_param);
  298 + //}
365 } 299 }
366 300
367 -  
368 - /////收到消息处理/////////////////////////////////////////////////////////////////////////////////  
369 tableUpdateHandler(owner, itemIdx, itemData) { 301 tableUpdateHandler(owner, itemIdx, itemData) {
370 try { 302 try {
371 let model=this.unPackPdu(owner, itemIdx,itemData); 303 let model=this.unPackPdu(owner, itemIdx,itemData);
372 loger.log('tableUpdateHandler',model); 304 loger.log('tableUpdateHandler',model);
  305 + //处理会议更新的信息
373 } catch (e) { 306 } catch (e) {
374 loger.warn('ConferApe table update got exception. itemIdx',itemIdx); 307 loger.warn('ConferApe table update got exception. itemIdx',itemIdx);
375 } 308 }
376 -  
377 -/* try {  
378 - let tabUpdatePdu = pdu["RCTabUpdateDataRequestPdu"].decode(itemData);  
379 - const uncompressedBytes = new Zlib.Inflate(tabUpdatePdu.action.compact().view).decompress();  
380 - let tabInfo = UTF8.getStringFromBytes(uncompressedBytes);  
381 - let tabTypeMatches = tabInfo.match(/<TabType>(.+)<\/TabType>/);  
382 - loger.log("更新列表数据 tableUpdateHandler","owner:"+owner, "itemIdx:"+itemIdx,"tabInfo:",tabInfo);  
383 - if (tabTypeMatches.length > 1 && tabTypeMatches[1] == 'show.docsharing') {  
384 - if (tabInfo.match(/<visible>(.+)<\/visible>/)[1] == 'true') {  
385 - this.activeDocId = tabInfo.match(/<TabID>(.+)<\/TabID>/)[1];  
386 - this._emit(MessageTypes.DOC_SWITCH, this.activeDocId);  
387 - }  
388 - }  
389 - } catch (e) {  
390 - loger.warn('ConferApe table update got exception. itemIdx',itemIdx);  
391 - }*/  
392 } 309 }
393 310
394 311
@@ -445,6 +362,95 @@ class ConferApe extends Ape { @@ -445,6 +362,95 @@ class ConferApe extends Ape {
445 emitRosterChange() { 362 emitRosterChange() {
446 this._emit(MessageTypes.CLASS_SHOW_ROSTER_NUM, Object.keys(this.rosters).length); 363 this._emit(MessageTypes.CLASS_SHOW_ROSTER_NUM, Object.keys(this.rosters).length);
447 } 364 }
  365 +
  366 + ///////数据的封包和解包/////////////////////////////////////////
  367 + packPdu(_param,_itemIdx){
  368 + loger.log("会议===packPdu ");
  369 + //验证坐标点集合数组是否合法
  370 + if(_param==null||_itemIdx==null){
  371 + this._emit(MessageTypes.MCU_ERROR,MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG);
  372 + return null;
  373 + }
  374 +
  375 + /* message RCClassStatusInfoPdu {
  376 + optional uint32 node_id=1;//mcu中的唯一ID
  377 + optional uint32 user_id=2;
  378 + optional uint32 user_name=3;
  379 + optional uint32 site_id=4;//站点号
  380 + optional uint32 class_id=5;
  381 + optional uint32 class_name=6;
  382 + required uint32 class_type=7;//课堂类型
  383 + required uint32 class_status=9;//课堂的状态
  384 + optional uint32 class_startTime=10;//课堂点击开始时间
  385 + optional uint32 class_stopTime=11;//最后一次停止的时间(点暂停或结束),每次发送数据都获取当前时间戳
  386 + optional uint32 class_timestamp=12;//相对于点开始课堂的时间戳
  387 + optional uint32 class_beginTime=13;//课堂创建的时间,这个是Sass返回的
  388 + optional uint32 class_endTime=14;//课堂结束的时间,这个是Sass返回的
  389 + optional uint32 record_status=15;//当前录制状态
  390 + optional uint32 record_timestamp=16;//相对于首次开始录制的时间戳
  391 + optional uint32 record_fileName=17;//录制的文件名
  392 + optional uint32 record_downloadUrl=18;//下载地址
  393 + optional uint32 server_timestamp=19;//当前的系统时间戳
  394 + }*/
  395 +
  396 + let classStatusInfo=new pdu['RCClassStatusInfoPdu'];
  397 + classStatusInfo.nodeId=GlobalConfig.nodeId;//mcu中的唯一ID
  398 + classStatusInfo.userId=GlobalConfig.userId;
  399 + classStatusInfo.userName=GlobalConfig.userName;
  400 + classStatusInfo.siteId=GlobalConfig.siteId;//站点号
  401 + classStatusInfo.classId=GlobalConfig.classId;
  402 + classStatusInfo.className=GlobalConfig.className;
  403 + classStatusInfo.classType=GlobalConfig.classType;//课堂类型
  404 + classStatusInfo.classStatus=GlobalConfig.classStatus;//课堂的状态
  405 + classStatusInfo.classStartTime=GlobalConfig.classStartTime;//课堂点击开始时间
  406 + classStatusInfo.classStopTime=GlobalConfig.classStopTime;//最后一次停止的时间(点暂停或结束),每次发送数据都获取当前时间戳
  407 + classStatusInfo.classTimestamp=GlobalConfig.classTimestamp;//相对于点开始课堂的时间戳
  408 + classStatusInfo.classBeginTime=GlobalConfig.classBeginTime;//课堂创建的时间,这个是Sass返回的
  409 + classStatusInfo.classEndTime=GlobalConfig.classEndTime;//课堂结束的时间,这个是Sass返回的
  410 + classStatusInfo.recordStatus=GlobalConfig.recordStatus;//当前录制状态
  411 + classStatusInfo.recordTimestamp=GlobalConfig.recordTimestamp;//相对于首次开始录制的时间戳
  412 + classStatusInfo.recordFileName=GlobalConfig.recordFileName;//录制的文件名
  413 + classStatusInfo.recordDownloadUrl=GlobalConfig.recordDownloadUrl;//下载地址
  414 + classStatusInfo.serverTimestamp=GlobalConfig.serverTimestamp;//当前的系统时间戳
  415 + classStatusInfo.activeDocId=GlobalConfig.activeDocId;//当前激活的文档id
  416 + classStatusInfo.activeDocCurPage=GlobalConfig.activeDocCurPage;//当前激活的文档的当前页
  417 +
  418 + loger.log("classStatusInfo-------------",classStatusInfo);
  419 +
  420 + /*
  421 + optional uint32 item_idx=1;
  422 + optional uint32 from=2;
  423 + optional uint32 owner=3;
  424 + optional uint32 action_type=4;//状态改变的类型
  425 + optional RCClassStatusInfoPdu class_status_info=5;//当前课堂状态的信息
  426 + */
  427 + //判断type类型,根据type设置不同的参数
  428 + let modelPdu =new pdu['RCClassSendDataModelPdu'];
  429 + modelPdu.itemIdx=_itemIdx;
  430 + modelPdu.from=GlobalConfig.nodeId;
  431 + modelPdu.owner=GlobalConfig.nodeId;
  432 + //modelPdu.actionType =_param.actionType;
  433 + modelPdu.classStatusInfo=classStatusInfo;
  434 + return modelPdu;
  435 + }
  436 +
  437 + unPackPdu(owner, itemIdx,itemData){
  438 + loger.log("会议===unPackPdu ");
  439 + if(owner==null||itemIdx==null||itemData==null){
  440 + this._emit(MessageTypes.MCU_ERROR,MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG);
  441 + return null;
  442 + }
  443 +
  444 + try{
  445 + let modelPdu= pdu['RCClassSendDataModelPdu'].decode(itemData);
  446 + return modelPdu;
  447 + }catch (err){
  448 + loger.log("会议收到数据 unPackPdu Pdu解析错误,itemIdx="+itemIdx+" err:"+err.message);
  449 + }
  450 + return null;
  451 + }
  452 +
  453 +
448 } 454 }
449 455
450 export default ConferApe; 456 export default ConferApe;
@@ -228,78 +228,6 @@ class DocApe extends Ape { @@ -228,78 +228,6 @@ class DocApe extends Ape {
228 this.sendUniform(adapterPdu,true); 228 this.sendUniform(adapterPdu,true);
229 } 229 }
230 230
231 - ///////白板数据的封包和解包/////////////////////////////////////////  
232 - packPdu(_param,_itemIdx){  
233 - loger.log("文档===packPdu ");  
234 - //验证坐标点集合数组是否合法  
235 - if(_param==null||_itemIdx==null){  
236 - this._emit(MessageTypes.MCU_ERROR,MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG);  
237 - return null;  
238 - }  
239 -  
240 - /* message RCDocSendDataModelPdu {  
241 - required uint32 item_idx=1;//唯一标识  
242 - required uint32 owner=2;  
243 - optional uint32 from=3;  
244 - optional uint32 cur_page_no=4;  
245 - optional uint32 page_num =5;  
246 - optional string file_type=6;  
247 - optional string creat_user_id=7;//创建文档userid  
248 - optional string relative_url=8;//文档相对地址  
249 - optional string url =9;//文档地址  
250 - optional uint32 cur_V=10;  
251 - optional uint32 cur_H=11;  
252 - optional uint32 scale=12;  
253 - optional bool visible=13;  
254 - optional uint32 action=14;//0,无操作, 1翻页 /缩放/滚动、2.显示/隐藏  
255 - optional string doc_id=15;//文档在服务器数据库中的唯一id  
256 - optional string file_name=16;//文档的名字  
257 - optional string dynamic_TS=17;//"dynamicTransferStatic": "0"  
258 - optional string md5=18;//md5  
259 - }*/  
260 -  
261 - //判断type类型,根据type设置不同的参数  
262 - let docModelPdu =new pdu['RCDocSendDataModelPdu'];  
263 - docModelPdu.itemIdx=_itemIdx;  
264 - docModelPdu.owner=GlobalConfig.nodeId;  
265 - docModelPdu.from=GlobalConfig.nodeId;  
266 - docModelPdu.curPageNo = _param.curPageNo||1;  
267 - docModelPdu.pageNum = _param.pageNum||1;  
268 - docModelPdu.fileType=_param.fileType||"";  
269 - docModelPdu.creatUserId=_param.creatUserId||"0";  
270 - docModelPdu.url =_param.url||"";//"http://101.200.150.192/DocSharing/data/h5test/20170206-171100025/7e9c4178cac1133e0dd9d5b583439122.jpg";  
271 - docModelPdu.relativeUrl=_param.relativeUrl||"";//"/DocSharing/data/h5test/20170206-171100025/7e9c4178cac1133e0dd9d5b583439122.jpg";  
272 - docModelPdu.curV=_param.curV||0;  
273 - docModelPdu.curH=_param.curH||0;  
274 - docModelPdu.scale=_param.scale||100;//按百分比  
275 - docModelPdu.visible= _param.visible||false;  
276 - docModelPdu.action=_param.action||ApeConsts.DOC_ACTION_NORMAL;//0,无操作, 1翻页、2.显示/隐藏, 3缩放/滚动  
277 - docModelPdu.docId=_param.docId||"";//文档在服务器数据库中的唯一id,必须有  
278 - docModelPdu.md5=_param.md5||"";//MD5  
279 - docModelPdu.fileName=_param.fileName||"doc_"+_itemIdx;//文档的名字  
280 - docModelPdu.dynamicTS=_param.dynamicTS||"0";//文档上传后返回值中的字段dynamicTransferStatic  
281 - console.log(docModelPdu);  
282 - return docModelPdu;  
283 - }  
284 -  
285 - unPackPdu(owner, itemIdx,itemData){  
286 - loger.log("文档===unPackPdu ");  
287 - if(owner==null||itemIdx==null||itemData==null){  
288 - this._emit(MessageTypes.MCU_ERROR,MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG);  
289 - return null;  
290 - }  
291 -  
292 - try{  
293 - let docModelPdu= pdu['RCDocSendDataModelPdu'].decode(itemData);  
294 - //console.log(whiteBoardModelPdu);  
295 - //loger.log(docModelPdu);  
296 - return docModelPdu;  
297 - }catch (err){  
298 - loger.log("文档收到数据 unPackPdu Pdu解析错误,itemIdx="+itemIdx+" err:"+err.message);  
299 - }  
300 - return null;  
301 - }  
302 -  
303 /////收到消息处理///////////////////////////////////////////////////////////////////////////////// 231 /////收到消息处理/////////////////////////////////////////////////////////////////////////////////
304 tableInsertHandler(owner, itemIdx, itemData) { 232 tableInsertHandler(owner, itemIdx, itemData) {
305 //this.tableUpdateHandler(owner, tableId, itemData); 233 //this.tableUpdateHandler(owner, tableId, itemData);
@@ -417,6 +345,80 @@ class DocApe extends Ape { @@ -417,6 +345,80 @@ class DocApe extends Ape {
417 //储存的数据中没有查找到 345 //储存的数据中没有查找到
418 return false; 346 return false;
419 } 347 }
  348 +
  349 + ///////数据的封包和解包/////////////////////////////////////////
  350 + packPdu(_param,_itemIdx){
  351 + loger.log("文档===packPdu ");
  352 + //验证坐标点集合数组是否合法
  353 + if(_param==null||_itemIdx==null){
  354 + this._emit(MessageTypes.MCU_ERROR,MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG);
  355 + return null;
  356 + }
  357 +
  358 + /* message RCDocSendDataModelPdu {
  359 + required uint32 item_idx=1;//唯一标识
  360 + required uint32 owner=2;
  361 + optional uint32 from=3;
  362 + optional uint32 cur_page_no=4;
  363 + optional uint32 page_num =5;
  364 + optional string file_type=6;
  365 + optional string creat_user_id=7;//创建文档userid
  366 + optional string relative_url=8;//文档相对地址
  367 + optional string url =9;//文档地址
  368 + optional uint32 cur_V=10;
  369 + optional uint32 cur_H=11;
  370 + optional uint32 scale=12;
  371 + optional bool visible=13;
  372 + optional uint32 action=14;//0,无操作, 1翻页 /缩放/滚动、2.显示/隐藏
  373 + optional string doc_id=15;//文档在服务器数据库中的唯一id
  374 + optional string file_name=16;//文档的名字
  375 + optional string dynamic_TS=17;//"dynamicTransferStatic": "0"
  376 + optional string md5=18;//md5
  377 + }*/
  378 +
  379 + //判断type类型,根据type设置不同的参数
  380 + let docModelPdu =new pdu['RCDocSendDataModelPdu'];
  381 + docModelPdu.itemIdx=_itemIdx;
  382 + docModelPdu.owner=GlobalConfig.nodeId;
  383 + docModelPdu.from=GlobalConfig.nodeId;
  384 + docModelPdu.curPageNo = _param.curPageNo||1;
  385 + docModelPdu.pageNum = _param.pageNum||1;
  386 + docModelPdu.fileType=_param.fileType||"";
  387 + docModelPdu.creatUserId=_param.creatUserId||"0";
  388 + docModelPdu.url =_param.url||"";//"http://101.200.150.192/DocSharing/data/h5test/20170206-171100025/7e9c4178cac1133e0dd9d5b583439122.jpg";
  389 + docModelPdu.relativeUrl=_param.relativeUrl||"";//"/DocSharing/data/h5test/20170206-171100025/7e9c4178cac1133e0dd9d5b583439122.jpg";
  390 + docModelPdu.curV=_param.curV||0;
  391 + docModelPdu.curH=_param.curH||0;
  392 + docModelPdu.scale=_param.scale||100;//按百分比
  393 + docModelPdu.visible= _param.visible||false;
  394 + docModelPdu.action=_param.action||ApeConsts.DOC_ACTION_NORMAL;//0,无操作, 1翻页、2.显示/隐藏, 3缩放/滚动
  395 + docModelPdu.docId=_param.docId||"";//文档在服务器数据库中的唯一id,必须有
  396 + docModelPdu.md5=_param.md5||"";//MD5
  397 + docModelPdu.fileName=_param.fileName||"doc_"+_itemIdx;//文档的名字
  398 + docModelPdu.dynamicTS=_param.dynamicTS||"0";//文档上传后返回值中的字段dynamicTransferStatic
  399 + console.log(docModelPdu);
  400 + return docModelPdu;
  401 + }
  402 +
  403 + unPackPdu(owner, itemIdx,itemData){
  404 + loger.log("文档===unPackPdu ");
  405 + if(owner==null||itemIdx==null||itemData==null){
  406 + this._emit(MessageTypes.MCU_ERROR,MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG);
  407 + return null;
  408 + }
  409 +
  410 + try{
  411 + let docModelPdu= pdu['RCDocSendDataModelPdu'].decode(itemData);
  412 + //console.log(whiteBoardModelPdu);
  413 + //loger.log(docModelPdu);
  414 + return docModelPdu;
  415 + }catch (err){
  416 + loger.log("文档收到数据 unPackPdu Pdu解析错误,itemIdx="+itemIdx+" err:"+err.message);
  417 + }
  418 + return null;
  419 + }
  420 +
  421 +
420 } 422 }
421 DocApe.prototype.DOC_JOIN_CHANNEL_SUCCESS = DocApe.DOC_JOIN_CHANNEL_SUCCESS = 'doc.join.channel.success'; 423 DocApe.prototype.DOC_JOIN_CHANNEL_SUCCESS = DocApe.DOC_JOIN_CHANNEL_SUCCESS = 'doc.join.channel.success';
422 export default DocApe; 424 export default DocApe;