正在显示
2 个修改的文件
包含
217 行增加
和
220 行删除
| @@ -26,7 +26,7 @@ import ArrayBufferUtil from 'libs/ArrayBufferUtil'; | @@ -26,7 +26,7 @@ import ArrayBufferUtil from 'libs/ArrayBufferUtil'; | ||
| 26 | import UTF8 from 'utf-8'; | 26 | import UTF8 from 'utf-8'; |
| 27 | 27 | ||
| 28 | let loger = Loger.getLoger('MessageEntrance'); | 28 | let loger = Loger.getLoger('MessageEntrance'); |
| 29 | -let _sdkInfo = {"version": "v1.9.4.20170417", "author": "www.3mang.com"}; | 29 | +let _sdkInfo = {"version": "v1.9.5.20170417", "author": "www.3mang.com"}; |
| 30 | 30 | ||
| 31 | //APE | 31 | //APE |
| 32 | let _sass; | 32 | let _sass; |
| @@ -141,7 +141,7 @@ export default class MessageEntrance extends Emiter { | @@ -141,7 +141,7 @@ export default class MessageEntrance extends Emiter { | ||
| 141 | this.getVideoPublishPath = this._getVideoPublishPath.bind(this); | 141 | this.getVideoPublishPath = this._getVideoPublishPath.bind(this); |
| 142 | this.getVideoAllChannelInfo = this._getVideoAllChannelInfo.bind(this); | 142 | this.getVideoAllChannelInfo = this._getVideoAllChannelInfo.bind(this); |
| 143 | this.publishVideo = this._publishVideo.bind(this); | 143 | this.publishVideo = this._publishVideo.bind(this); |
| 144 | - this.stopPublishVideo =this.unPublishVideo= this._stopPublishVideo.bind(this); | 144 | + this.stopPublishVideo = this.unPublishVideo = this._stopPublishVideo.bind(this); |
| 145 | this.sendVideoBroadcastMsg = this._sendVideoBroadcastMsg.bind(this); | 145 | this.sendVideoBroadcastMsg = this._sendVideoBroadcastMsg.bind(this); |
| 146 | 146 | ||
| 147 | 147 | ||
| @@ -150,7 +150,7 @@ export default class MessageEntrance extends Emiter { | @@ -150,7 +150,7 @@ export default class MessageEntrance extends Emiter { | ||
| 150 | this.getAudioPublishPath = this._getPublishAudioPath.bind(this); | 150 | this.getAudioPublishPath = this._getPublishAudioPath.bind(this); |
| 151 | this.getAudioAllChannelInfo = this._getAudioAllChannelInfo.bind(this); | 151 | this.getAudioAllChannelInfo = this._getAudioAllChannelInfo.bind(this); |
| 152 | this.publishAudio = this._publishAudio.bind(this); | 152 | this.publishAudio = this._publishAudio.bind(this); |
| 153 | - this.stopPublishAudio =this.unPublishAudio= this._stopPublishAudio.bind(this); | 153 | + this.stopPublishAudio = this.unPublishAudio = this._stopPublishAudio.bind(this); |
| 154 | this.sendAudioBroadcastMsg = this.sendAudioCommandMsg.bind(this); | 154 | this.sendAudioBroadcastMsg = this.sendAudioCommandMsg.bind(this); |
| 155 | 155 | ||
| 156 | //whiteBoradApe | 156 | //whiteBoradApe |
| @@ -164,7 +164,7 @@ export default class MessageEntrance extends Emiter { | @@ -164,7 +164,7 @@ export default class MessageEntrance extends Emiter { | ||
| 164 | this.sendDocumentSwitchDoc = this._sendDocumentSwitchDoc.bind(this); //切换文档 | 164 | this.sendDocumentSwitchDoc = this._sendDocumentSwitchDoc.bind(this); //切换文档 |
| 165 | this.sendDocumentSwitchPage = this._sendDocumentSwitchPage.bind(this);//翻页 | 165 | this.sendDocumentSwitchPage = this._sendDocumentSwitchPage.bind(this);//翻页 |
| 166 | this.sendDocumentDelete = this._sassDeleteDocument.bind(this); | 166 | this.sendDocumentDelete = this._sassDeleteDocument.bind(this); |
| 167 | - this.sendDocBroadcastMsg=this._sendDocBroadcastMsg.bind(this); | 167 | + this.sendDocBroadcastMsg = this._sendDocBroadcastMsg.bind(this); |
| 168 | //删除文档,先通过Sass删除,sass删除成功之后再同步mcu | 168 | //删除文档,先通过Sass删除,sass删除成功之后再同步mcu |
| 169 | //this.sendDocumentDeleteAll= this._documentDeleteAll;//删除所有文档 | 169 | //this.sendDocumentDeleteAll= this._documentDeleteAll;//删除所有文档 |
| 170 | this.sendDocumentCommand = this._sendDocumentCommand.bind(this); | 170 | this.sendDocumentCommand = this._sendDocumentCommand.bind(this); |
| @@ -172,22 +172,24 @@ export default class MessageEntrance extends Emiter { | @@ -172,22 +172,24 @@ export default class MessageEntrance extends Emiter { | ||
| 172 | this.getDocImageFullPath = this._getDocImageFullPath.bind(this); | 172 | this.getDocImageFullPath = this._getDocImageFullPath.bind(this); |
| 173 | //获取文档图片的完整路径 | 173 | //获取文档图片的完整路径 |
| 174 | this.getDocPDFFullPath = this._getDocPDFFullPath.bind(this);//获取文档的完整路径 | 174 | this.getDocPDFFullPath = this._getDocPDFFullPath.bind(this);//获取文档的完整路径 |
| 175 | - this.getDocFullAddress=this._getDocFullAddress.bind(this);//获取文档资源地址 | 175 | + this.getDocFullAddress = this._getDocFullAddress.bind(this);//获取文档资源地址 |
| 176 | 176 | ||
| 177 | 177 | ||
| 178 | this.setDebuger = this._setDebuger.bind(this);//debug | 178 | this.setDebuger = this._setDebuger.bind(this);//debug |
| 179 | - this.setMessageDelay=this._setMessageDelay.bind(this);//设置是否延迟消息 | 179 | + this.setMessageDelay = this._setMessageDelay.bind(this);//设置是否延迟消息 |
| 180 | } | 180 | } |
| 181 | 181 | ||
| 182 | - _setDebuger(_data){ | ||
| 183 | - GlobalConfig.isDebuger=_data.isDebuger||true; | 182 | + _setDebuger(_data) { |
| 183 | + GlobalConfig.isDebuger = _data.isDebuger || true; | ||
| 184 | } | 184 | } |
| 185 | - _setMessageDelay(_data){ | ||
| 186 | - loger.warn("延迟消息-->", _data); | ||
| 187 | - if(_data){ | ||
| 188 | - GlobalConfig.messageDelay=Boolean(_data.messageDelay); | ||
| 189 | - } | ||
| 190 | - } | 185 | + |
| 186 | + _setMessageDelay(_data) { | ||
| 187 | + loger.warn("延迟消息-->", _data); | ||
| 188 | + if (_data) { | ||
| 189 | + GlobalConfig.messageDelay = Boolean(_data.messageDelay); | ||
| 190 | + } | ||
| 191 | + } | ||
| 192 | + | ||
| 191 | //mcu异常监听 | 193 | //mcu异常监听 |
| 192 | _mcuErrorHandler(_data, _option) { | 194 | _mcuErrorHandler(_data, _option) { |
| 193 | let option = _option || ""; | 195 | let option = _option || ""; |
| @@ -241,12 +243,13 @@ export default class MessageEntrance extends Emiter { | @@ -241,12 +243,13 @@ export default class MessageEntrance extends Emiter { | ||
| 241 | _sass.saveClassRecordContrlInfo(_param); | 243 | _sass.saveClassRecordContrlInfo(_param); |
| 242 | } | 244 | } |
| 243 | } | 245 | } |
| 246 | + | ||
| 244 | //开启录制成功 | 247 | //开启录制成功 |
| 245 | - _onClassRecordSuccess(_param){ | ||
| 246 | - if(_doc_ape){ | 248 | + _onClassRecordSuccess(_param) { |
| 249 | + if (_doc_ape) { | ||
| 247 | _doc_ape.updaterRecordStatus(); | 250 | _doc_ape.updaterRecordStatus(); |
| 248 | } | 251 | } |
| 249 | - if(_whiteboard_ape){ | 252 | + if (_whiteboard_ape) { |
| 250 | _whiteboard_ape.updaterRecordStatus(); | 253 | _whiteboard_ape.updaterRecordStatus(); |
| 251 | } | 254 | } |
| 252 | } | 255 | } |
| @@ -271,7 +274,7 @@ export default class MessageEntrance extends Emiter { | @@ -271,7 +274,7 @@ export default class MessageEntrance extends Emiter { | ||
| 271 | //当前课堂中视频或音频占用channel的nodeId ,在人员列表中不存在,这种情况是占用channel的人员掉线或离开的时候没有释放channel | 274 | //当前课堂中视频或音频占用channel的nodeId ,在人员列表中不存在,这种情况是占用channel的人员掉线或离开的时候没有释放channel |
| 272 | //的占用状态导致,对于这种情况,需要释放掉 | 275 | //的占用状态导致,对于这种情况,需要释放掉 |
| 273 | _onClassNonentityRoster(_param) { | 276 | _onClassNonentityRoster(_param) { |
| 274 | - if(GlobalConfig.isRecordPlayBack){ | 277 | + if (GlobalConfig.isRecordPlayBack) { |
| 275 | loger.warn("录制回放中,不处理") | 278 | loger.warn("录制回放中,不处理") |
| 276 | return; | 279 | return; |
| 277 | } | 280 | } |
| @@ -309,7 +312,7 @@ export default class MessageEntrance extends Emiter { | @@ -309,7 +312,7 @@ export default class MessageEntrance extends Emiter { | ||
| 309 | loger.log('init', _param); | 312 | loger.log('init', _param); |
| 310 | 313 | ||
| 311 | //保存参数 | 314 | //保存参数 |
| 312 | - GlobalConfig.isRecordPlayBack=false;//设置为非录制回放状态 | 315 | + GlobalConfig.isRecordPlayBack = false;//设置为非录制回放状态 |
| 313 | GlobalConfig.classId = parseInt(_param.classId); | 316 | GlobalConfig.classId = parseInt(_param.classId); |
| 314 | GlobalConfig.portal = _param.portal; | 317 | GlobalConfig.portal = _param.portal; |
| 315 | GlobalConfig.userId = _param.userId || "0"; | 318 | GlobalConfig.userId = _param.userId || "0"; |
| @@ -317,20 +320,20 @@ export default class MessageEntrance extends Emiter { | @@ -317,20 +320,20 @@ export default class MessageEntrance extends Emiter { | ||
| 317 | 320 | ||
| 318 | //设置角色身份 | 321 | //设置角色身份 |
| 319 | GlobalConfig.userRole = _param.userRole || ApeConsts.normal; | 322 | GlobalConfig.userRole = _param.userRole || ApeConsts.normal; |
| 320 | - if(GlobalConfig.userRole!=ApeConsts.host&& | ||
| 321 | - GlobalConfig.userRole!=ApeConsts.presenter&& | ||
| 322 | - GlobalConfig.userRole!=ApeConsts.assistant&& | ||
| 323 | - GlobalConfig.userRole!=ApeConsts.record&& | ||
| 324 | - GlobalConfig.userRole!=ApeConsts.invisible){ | ||
| 325 | - GlobalConfig.userRole= ApeConsts.normal; | 323 | + if (GlobalConfig.userRole != ApeConsts.host && |
| 324 | + GlobalConfig.userRole != ApeConsts.presenter && | ||
| 325 | + GlobalConfig.userRole != ApeConsts.assistant && | ||
| 326 | + GlobalConfig.userRole != ApeConsts.record && | ||
| 327 | + GlobalConfig.userRole != ApeConsts.invisible) { | ||
| 328 | + GlobalConfig.userRole = ApeConsts.normal; | ||
| 326 | } | 329 | } |
| 327 | 330 | ||
| 328 | //客户端决定是否延迟接收消息 | 331 | //客户端决定是否延迟接收消息 |
| 329 | GlobalConfig.messageDelay = _param.messageDelay || false; | 332 | GlobalConfig.messageDelay = _param.messageDelay || false; |
| 330 | 333 | ||
| 331 | //最长允许录制的时间 | 334 | //最长允许录制的时间 |
| 332 | - if(_param.allowRecordMaxTime){ | ||
| 333 | - GlobalConfig.allowRecordMaxTime=parseInt(_param.allowRecordMaxTime); | 335 | + if (_param.allowRecordMaxTime) { |
| 336 | + GlobalConfig.allowRecordMaxTime = parseInt(_param.allowRecordMaxTime); | ||
| 334 | } | 337 | } |
| 335 | 338 | ||
| 336 | //获取课堂校验信息 | 339 | //获取课堂校验信息 |
| @@ -341,8 +344,6 @@ export default class MessageEntrance extends Emiter { | @@ -341,8 +344,6 @@ export default class MessageEntrance extends Emiter { | ||
| 341 | 344 | ||
| 342 | //外部请求加入课堂 | 345 | //外部请求加入课堂 |
| 343 | _joinClass(_param) { | 346 | _joinClass(_param) { |
| 344 | - //_joinClassSuccessCallBackFun = _onSuccess; | ||
| 345 | - //{"userName":"名字","password":""} | ||
| 346 | if (_param == null || EngineUtils.isEmptyObject(_param)) { | 347 | if (_param == null || EngineUtils.isEmptyObject(_param)) { |
| 347 | this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_CLASS_JOIN_PARAM); | 348 | this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_CLASS_JOIN_PARAM); |
| 348 | loger.log('不能进入课堂,传递的参数不对.', _param); | 349 | loger.log('不能进入课堂,传递的参数不对.', _param); |
| @@ -354,22 +355,22 @@ export default class MessageEntrance extends Emiter { | @@ -354,22 +355,22 @@ export default class MessageEntrance extends Emiter { | ||
| 354 | this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_CLASS_JOIN_PARAM); | 355 | this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_CLASS_JOIN_PARAM); |
| 355 | return; | 356 | return; |
| 356 | } | 357 | } |
| 357 | - | ||
| 358 | - GlobalConfig.userName = _param.userName||GlobalConfig.userName;//以登陆时的名字为主,登陆之前可以修改名字 | ||
| 359 | - GlobalConfig.autoLogin=_param.autoLogin||""; | 358 | + //{"userName":"名字","password":"","autoLogin":""} |
| 359 | + GlobalConfig.userName = _param.userName || GlobalConfig.userName;//以登陆时的名字为主,登陆之前可以修改名字 | ||
| 360 | + GlobalConfig.autoLogin = _param.autoLogin || ""; | ||
| 360 | GlobalConfig.password = _param.password || ""; | 361 | GlobalConfig.password = _param.password || ""; |
| 361 | GlobalConfig.hasCamera = (typeof _param.hasCamera == "boolean") ? _param.hasCamera : false; | 362 | GlobalConfig.hasCamera = (typeof _param.hasCamera == "boolean") ? _param.hasCamera : false; |
| 362 | GlobalConfig.hasMicrophone = (typeof _param.hasMicrophone == "boolean") ? _param.hasMicrophone : false; | 363 | GlobalConfig.hasMicrophone = (typeof _param.hasMicrophone == "boolean") ? _param.hasMicrophone : false; |
| 363 | 364 | ||
| 364 | - loger.log("autoLoginMd5",GlobalConfig.classId,GlobalConfig.userId,GlobalConfig.userRole); | ||
| 365 | - let autoLoginMd5=MD5(""+GlobalConfig.classId+GlobalConfig.userId+GlobalConfig.userRole); | ||
| 366 | - loger.log("joinClass-GlobalConfig.autoLogin",GlobalConfig.autoLogin,"autoLoginMd5-",autoLoginMd5); | ||
| 367 | - if(GlobalConfig.autoLogin&&autoLoginMd5==GlobalConfig.autoLogin){ | ||
| 368 | - // MD5(classId+userId+userRole)==m | 365 | + loger.log("autoLoginMd5", GlobalConfig.classId, GlobalConfig.userId, GlobalConfig.userRole); |
| 366 | + let autoLoginMd5 = MD5("" + GlobalConfig.classId + GlobalConfig.userId + GlobalConfig.userRole); | ||
| 367 | + loger.log("joinClass-GlobalConfig.autoLogin", GlobalConfig.autoLogin, "autoLoginMd5-", autoLoginMd5); | ||
| 368 | + if (GlobalConfig.autoLogin && autoLoginMd5 == GlobalConfig.autoLogin) { | ||
| 369 | + // MD5(classId+userId+userRole)==m | ||
| 369 | //自动登录,跳过验证流程 | 370 | //自动登录,跳过验证流程 |
| 370 | loger.log("自动登录"); | 371 | loger.log("自动登录"); |
| 371 | this._sassJoinSuccessHandler(); | 372 | this._sassJoinSuccessHandler(); |
| 372 | - }else { | 373 | + } else { |
| 373 | //不能自动登录,开始校验 | 374 | //不能自动登录,开始校验 |
| 374 | if (_sass) { | 375 | if (_sass) { |
| 375 | _sass.passwordAndMd5Checking(GlobalConfig.getClassInfo()); | 376 | _sass.passwordAndMd5Checking(GlobalConfig.getClassInfo()); |
| @@ -414,28 +415,15 @@ export default class MessageEntrance extends Emiter { | @@ -414,28 +415,15 @@ export default class MessageEntrance extends Emiter { | ||
| 414 | 415 | ||
| 415 | // 通过SASS平台验证(密码和MD5) | 416 | // 通过SASS平台验证(密码和MD5) |
| 416 | _sassJoinSuccessHandler(_data) { | 417 | _sassJoinSuccessHandler(_data) { |
| 417 | - //返回值 | ||
| 418 | - /* flag 数值型 无 True:成功 | ||
| 419 | - Flag:失败 | ||
| 420 | - h5_mcu_list 字符串 H5muc列表 | ||
| 421 | - maxVideoChannels 数值型 最大视频路数 | ||
| 422 | - maxAudioChannels 数值型 最大音频路数 | ||
| 423 | - h5Module 数值型 H5开关 | ||
| 424 | - ms 字符串 Ms列表 | ||
| 425 | - mcu 字符串 Mcu列表 | ||
| 426 | - rs 字符串 Rs列表 | ||
| 427 | - doc 字符串 Doc列表*/ | ||
| 428 | //获取课堂最完整的数据 | 418 | //获取课堂最完整的数据 |
| 429 | if (_sass) { | 419 | if (_sass) { |
| 430 | _sass.getClassParam(); | 420 | _sass.getClassParam(); |
| 431 | } | 421 | } |
| 432 | } | 422 | } |
| 433 | 423 | ||
| 434 | - //获取课堂所有参数 api/meeting/detail.do? flash中的接口文件是 getClassParam.do | 424 | + //获取课堂所有参数 api/meeting/detail.do? flash中的接口文件是 getClassParam.do |
| 435 | _sassGetClassParamSuccessHandler(_data) { | 425 | _sassGetClassParamSuccessHandler(_data) { |
| 436 | - //console.log(GlobalConfig.classStatusInfo) | ||
| 437 | loger.log('获取课堂课堂的完整信息完成.'); | 426 | loger.log('获取课堂课堂的完整信息完成.'); |
| 438 | - // console.log(_data); | ||
| 439 | //包含整个课堂最全的信息,储存数据 | 427 | //包含整个课堂最全的信息,储存数据 |
| 440 | if (_data) { | 428 | if (_data) { |
| 441 | GlobalConfig.mcuDelay = _data.h5Delay || 0;//mcu消息延迟的时间间隔,单位(秒),结合客户端传的messageDelay的值使用 | 429 | GlobalConfig.mcuDelay = _data.h5Delay || 0;//mcu消息延迟的时间间隔,单位(秒),结合客户端传的messageDelay的值使用 |
| @@ -448,12 +436,13 @@ export default class MessageEntrance extends Emiter { | @@ -448,12 +436,13 @@ export default class MessageEntrance extends Emiter { | ||
| 448 | GlobalConfig.maxAudioChannels = _data.maxAudioChannels; | 436 | GlobalConfig.maxAudioChannels = _data.maxAudioChannels; |
| 449 | 437 | ||
| 450 | //视频质量相关设置 | 438 | //视频质量相关设置 |
| 451 | - GlobalConfig.fps = _data.fps||15; | ||
| 452 | - GlobalConfig.gop = _data.gop||3;; | ||
| 453 | - GlobalConfig.videoQuality = _data.videoQuality||2; | 439 | + GlobalConfig.fps = _data.fps || 15; |
| 440 | + GlobalConfig.gop = _data.gop || 3; | ||
| 441 | + ; | ||
| 442 | + GlobalConfig.videoQuality = _data.videoQuality || 2; | ||
| 454 | 443 | ||
| 455 | //是否自动开始(身份是host的时候才用到的) | 444 | //是否自动开始(身份是host的时候才用到的) |
| 456 | - GlobalConfig.isAutoStartClass= _data.autoRecord||0; | 445 | + GlobalConfig.isAutoStartClass = _data.autoRecord || 0; |
| 457 | 446 | ||
| 458 | GlobalConfig.setDocListPrepare(_data.docListPrepare); //提前上传的文档列表 | 447 | GlobalConfig.setDocListPrepare(_data.docListPrepare); //提前上传的文档列表 |
| 459 | GlobalConfig.setRecordList(_data.recordList);//录制回放地址 | 448 | GlobalConfig.setRecordList(_data.recordList);//录制回放地址 |
| @@ -465,37 +454,37 @@ export default class MessageEntrance extends Emiter { | @@ -465,37 +454,37 @@ export default class MessageEntrance extends Emiter { | ||
| 465 | GlobalConfig.setMusicListPrepare(_data.musicListPrepare);//提前上传的声音文件列表 | 454 | GlobalConfig.setMusicListPrepare(_data.musicListPrepare);//提前上传的声音文件列表 |
| 466 | 455 | ||
| 467 | 456 | ||
| 468 | - if (_data.mcuList&&_data.mcuList.length>0) { | 457 | + if (_data.mcuList && _data.mcuList.length > 0) { |
| 469 | //MCU地址默认使用第一个 | 458 | //MCU地址默认使用第一个 |
| 470 | GlobalConfig.MCUServerIP = _data.mcuList[0].ip || ""; | 459 | GlobalConfig.MCUServerIP = _data.mcuList[0].ip || ""; |
| 471 | GlobalConfig.MCUServerPort = _data.mcuList[0].port || ""; | 460 | GlobalConfig.MCUServerPort = _data.mcuList[0].port || ""; |
| 472 | } | 461 | } |
| 473 | 462 | ||
| 474 | //上课中视频推流播流地址 | 463 | //上课中视频推流播流地址 |
| 475 | - if (_data.msList&&_data.msList.length>0) { | 464 | + if (_data.msList && _data.msList.length > 0) { |
| 476 | //MS地址默认使用第一个 | 465 | //MS地址默认使用第一个 |
| 477 | GlobalConfig.MSServerIP = _data.msList[0].ip || ""; | 466 | GlobalConfig.MSServerIP = _data.msList[0].ip || ""; |
| 478 | GlobalConfig.MSServerPort = _data.msList[0].port || ""; | 467 | GlobalConfig.MSServerPort = _data.msList[0].port || ""; |
| 479 | } | 468 | } |
| 480 | 469 | ||
| 481 | //录制回放时m3u8播流地址 | 470 | //录制回放时m3u8播流地址 |
| 482 | - if (_data.rsList&&_data.rsList.length>0) { | 471 | + if (_data.rsList && _data.rsList.length > 0) { |
| 483 | //RS地址默认使用第一个 | 472 | //RS地址默认使用第一个 |
| 484 | GlobalConfig.RSServerIP = _data.rsList[0].ip || ""; | 473 | GlobalConfig.RSServerIP = _data.rsList[0].ip || ""; |
| 485 | GlobalConfig.RSServerPort = _data.rsList[0].port || ""; | 474 | GlobalConfig.RSServerPort = _data.rsList[0].port || ""; |
| 486 | } | 475 | } |
| 487 | 476 | ||
| 488 | //文档地址 | 477 | //文档地址 |
| 489 | - if (_data.docList&&_data.docList.length>0) { | 478 | + if (_data.docList && _data.docList.length > 0) { |
| 490 | //doc上传地址,随机获取一个 | 479 | //doc上传地址,随机获取一个 |
| 491 | - let index=parseInt(Math.random()*_data.docList.length); | 480 | + let index = parseInt(Math.random() * _data.docList.length); |
| 492 | loger.log("docServer->", _data.docList[index]); | 481 | loger.log("docServer->", _data.docList[index]); |
| 493 | GlobalConfig.DOCServerIP = _data.docList[index].ip || ""; | 482 | GlobalConfig.DOCServerIP = _data.docList[index].ip || ""; |
| 494 | GlobalConfig.DOCServerPort = _data.docList[index].port || ""; | 483 | GlobalConfig.DOCServerPort = _data.docList[index].port || ""; |
| 495 | } | 484 | } |
| 496 | 485 | ||
| 497 | //record | 486 | //record |
| 498 | - if (_data.recordList&&_data.recordList.length>0) { | 487 | + if (_data.recordList && _data.recordList.length > 0) { |
| 499 | //地址默认使用第一个 | 488 | //地址默认使用第一个 |
| 500 | GlobalConfig.RecordServerIP = _data.recordList[0].ip || ""; | 489 | GlobalConfig.RecordServerIP = _data.recordList[0].ip || ""; |
| 501 | GlobalConfig.RecordServerPort = _data.recordList[0].port || ""; | 490 | GlobalConfig.RecordServerPort = _data.recordList[0].port || ""; |
| @@ -508,7 +497,7 @@ export default class MessageEntrance extends Emiter { | @@ -508,7 +497,7 @@ export default class MessageEntrance extends Emiter { | ||
| 508 | loger.log("本地同步最后一次保存过的课堂状态信息"); | 497 | loger.log("本地同步最后一次保存过的课堂状态信息"); |
| 509 | try { | 498 | try { |
| 510 | GlobalConfig.setClassStatusInfo(JSON.parse(_data.currentInfo)); | 499 | GlobalConfig.setClassStatusInfo(JSON.parse(_data.currentInfo)); |
| 511 | - }catch (err){ | 500 | + } catch (err) { |
| 512 | GlobalConfig.setClassStatusInfo(_data.currentInfo); | 501 | GlobalConfig.setClassStatusInfo(_data.currentInfo); |
| 513 | } | 502 | } |
| 514 | loger.log(GlobalConfig.classStatusInfo); | 503 | loger.log(GlobalConfig.classStatusInfo); |
| @@ -518,21 +507,21 @@ export default class MessageEntrance extends Emiter { | @@ -518,21 +507,21 @@ export default class MessageEntrance extends Emiter { | ||
| 518 | 507 | ||
| 519 | 508 | ||
| 520 | //录制回放不需要选点 | 509 | //录制回放不需要选点 |
| 521 | - if(GlobalConfig.isRecordPlayBack){ | 510 | + if (GlobalConfig.isRecordPlayBack) { |
| 522 | if (_recordPlayback) { | 511 | if (_recordPlayback) { |
| 523 | //开启录制回放流程 | 512 | //开启录制回放流程 |
| 524 | loger.log("开启录制回放流程"); | 513 | loger.log("开启录制回放流程"); |
| 525 | _recordPlayback.readyRecordPlay(); | 514 | _recordPlayback.readyRecordPlay(); |
| 526 | - }else { | 515 | + } else { |
| 527 | loger.warn("开启录制回放流程失败,还未创建模块"); | 516 | loger.warn("开启录制回放流程失败,还未创建模块"); |
| 528 | } | 517 | } |
| 529 | - }else { | 518 | + } else { |
| 530 | //根据用户的userIp获取信息 | 519 | //根据用户的userIp获取信息 |
| 531 | this.getUserIpInfo(); | 520 | this.getUserIpInfo(); |
| 532 | } | 521 | } |
| 533 | } | 522 | } |
| 534 | 523 | ||
| 535 | - //根据UserIp获取ip信息 | 524 | + //根据UserIp获取ip信息,选点 |
| 536 | getUserIpInfo() { | 525 | getUserIpInfo() { |
| 537 | if (_serverCheck) { | 526 | if (_serverCheck) { |
| 538 | _serverCheck.getUserIpInfo("", GlobalConfig.userIp); | 527 | _serverCheck.getUserIpInfo("", GlobalConfig.userIp); |
| @@ -549,12 +538,12 @@ export default class MessageEntrance extends Emiter { | @@ -549,12 +538,12 @@ export default class MessageEntrance extends Emiter { | ||
| 549 | _sassSaveClassStatusInfo(_param) { | 538 | _sassSaveClassStatusInfo(_param) { |
| 550 | //{isForce:true} isForce->是否强制提交(true为是) | 539 | //{isForce:true} isForce->是否强制提交(true为是) |
| 551 | //这个是特殊权限 | 540 | //这个是特殊权限 |
| 552 | - let isForce=false; | ||
| 553 | - if(_param&&_param.isForce==true){ | ||
| 554 | - isForce=true; | 541 | + let isForce = false; |
| 542 | + if (_param && _param.isForce == true) { | ||
| 543 | + isForce = true; | ||
| 555 | } | 544 | } |
| 556 | 545 | ||
| 557 | - if (GlobalConfig.isHost||isForce) { | 546 | + if (GlobalConfig.isHost || isForce) { |
| 558 | //只有加入课堂之后才能保存数据 | 547 | //只有加入课堂之后才能保存数据 |
| 559 | if (GlobalConfig.getCurrentStatus().code == GlobalConfig.statusCode_2.code) { | 548 | if (GlobalConfig.getCurrentStatus().code == GlobalConfig.statusCode_2.code) { |
| 560 | //POST 保存数据 | 549 | //POST 保存数据 |
| @@ -594,12 +583,12 @@ export default class MessageEntrance extends Emiter { | @@ -594,12 +583,12 @@ export default class MessageEntrance extends Emiter { | ||
| 594 | //返回给客户端初始化成功的数据 | 583 | //返回给客户端初始化成功的数据 |
| 595 | let joinClassSuccessCallBackData = {}; | 584 | let joinClassSuccessCallBackData = {}; |
| 596 | 585 | ||
| 597 | - joinClassSuccessCallBackData.isRecordPlayBack=GlobalConfig.isRecordPlayBack; | 586 | + joinClassSuccessCallBackData.isRecordPlayBack = GlobalConfig.isRecordPlayBack; |
| 598 | 587 | ||
| 599 | joinClassSuccessCallBackData.DOCServerIP = GlobalConfig.DOCServerIP; | 588 | joinClassSuccessCallBackData.DOCServerIP = GlobalConfig.DOCServerIP; |
| 600 | joinClassSuccessCallBackData.DOCServerPort = GlobalConfig.DOCServerPort; | 589 | joinClassSuccessCallBackData.DOCServerPort = GlobalConfig.DOCServerPort; |
| 601 | 590 | ||
| 602 | - joinClassSuccessCallBackData.classStatus= GlobalConfig.classStatus; | 591 | + joinClassSuccessCallBackData.classStatus = GlobalConfig.classStatus; |
| 603 | joinClassSuccessCallBackData.classId = GlobalConfig.classId; | 592 | joinClassSuccessCallBackData.classId = GlobalConfig.classId; |
| 604 | joinClassSuccessCallBackData.className = GlobalConfig.className; | 593 | joinClassSuccessCallBackData.className = GlobalConfig.className; |
| 605 | joinClassSuccessCallBackData.h5Module = GlobalConfig.h5Module; | 594 | joinClassSuccessCallBackData.h5Module = GlobalConfig.h5Module; |
| @@ -634,13 +623,13 @@ export default class MessageEntrance extends Emiter { | @@ -634,13 +623,13 @@ export default class MessageEntrance extends Emiter { | ||
| 634 | joinClassSuccessCallBackData.province = GlobalConfig.province;//服务商 | 623 | joinClassSuccessCallBackData.province = GlobalConfig.province;//服务商 |
| 635 | joinClassSuccessCallBackData.isp = GlobalConfig.isp;//服务商 | 624 | joinClassSuccessCallBackData.isp = GlobalConfig.isp;//服务商 |
| 636 | 625 | ||
| 637 | - joinClassSuccessCallBackData.classTimestamp=GlobalConfig.classTimestamp;//课堂进行的累积时间 | ||
| 638 | - joinClassSuccessCallBackData.recordTimestamp=GlobalConfig.recordTimestamp;//课堂录制的累积时间 | ||
| 639 | - joinClassSuccessCallBackData.recordPlaybackMaxTime=GlobalConfig.recordPlaybackMaxTime;//录制回放的总时间 | 626 | + joinClassSuccessCallBackData.classTimestamp = GlobalConfig.classTimestamp;//课堂进行的累积时间 |
| 627 | + joinClassSuccessCallBackData.recordTimestamp = GlobalConfig.recordTimestamp;//课堂录制的累积时间 | ||
| 628 | + joinClassSuccessCallBackData.recordPlaybackMaxTime = GlobalConfig.recordPlaybackMaxTime;//录制回放的总时间 | ||
| 640 | 629 | ||
| 641 | - joinClassSuccessCallBackData.fps=GlobalConfig.fps; | ||
| 642 | - joinClassSuccessCallBackData.gop=GlobalConfig.gop; | ||
| 643 | - joinClassSuccessCallBackData.videoQuality=GlobalConfig.videoQuality; | 630 | + joinClassSuccessCallBackData.fps = GlobalConfig.fps; |
| 631 | + joinClassSuccessCallBackData.gop = GlobalConfig.gop; | ||
| 632 | + joinClassSuccessCallBackData.videoQuality = GlobalConfig.videoQuality; | ||
| 644 | 633 | ||
| 645 | loger.log('加入课堂成功'); | 634 | loger.log('加入课堂成功'); |
| 646 | loger.log(joinClassSuccessCallBackData); | 635 | loger.log(joinClassSuccessCallBackData); |
| @@ -675,7 +664,7 @@ export default class MessageEntrance extends Emiter { | @@ -675,7 +664,7 @@ export default class MessageEntrance extends Emiter { | ||
| 675 | } | 664 | } |
| 676 | } | 665 | } |
| 677 | 666 | ||
| 678 | - _sendDocBroadcastMsg(_param){ | 667 | + _sendDocBroadcastMsg(_param) { |
| 679 | if (!_mcu.connected) { | 668 | if (!_mcu.connected) { |
| 680 | loger.warn(GlobalConfig.getCurrentStatus()); | 669 | loger.warn(GlobalConfig.getCurrentStatus()); |
| 681 | return; | 670 | return; |
| @@ -684,6 +673,7 @@ export default class MessageEntrance extends Emiter { | @@ -684,6 +673,7 @@ export default class MessageEntrance extends Emiter { | ||
| 684 | _doc_ape.sendDocBroadcastMsg(_param); | 673 | _doc_ape.sendDocBroadcastMsg(_param); |
| 685 | } | 674 | } |
| 686 | } | 675 | } |
| 676 | + | ||
| 687 | //Sass删除文档成功之后,同步删除MCU数据 | 677 | //Sass删除文档成功之后,同步删除MCU数据 |
| 688 | _sassDeleteDocumentSuccess(_param) { | 678 | _sassDeleteDocumentSuccess(_param) { |
| 689 | loger.log('sassDeleteDocumentSuccess', _param); | 679 | loger.log('sassDeleteDocumentSuccess', _param); |
| @@ -807,7 +797,7 @@ export default class MessageEntrance extends Emiter { | @@ -807,7 +797,7 @@ export default class MessageEntrance extends Emiter { | ||
| 807 | _publishVideo(_param) { | 797 | _publishVideo(_param) { |
| 808 | if (!_mcu.connected) { | 798 | if (!_mcu.connected) { |
| 809 | loger.warn(GlobalConfig.getCurrentStatus()); | 799 | loger.warn(GlobalConfig.getCurrentStatus()); |
| 810 | - return {"code":ApeConsts.RETURN_FAILED, "data":""}; | 800 | + return {"code": ApeConsts.RETURN_FAILED, "data": ""}; |
| 811 | } | 801 | } |
| 812 | if (_video_ape) { | 802 | if (_video_ape) { |
| 813 | return _video_ape.publishVideo(_param); | 803 | return _video_ape.publishVideo(_param); |
| @@ -817,7 +807,7 @@ export default class MessageEntrance extends Emiter { | @@ -817,7 +807,7 @@ export default class MessageEntrance extends Emiter { | ||
| 817 | _stopPublishVideo(_param) { | 807 | _stopPublishVideo(_param) { |
| 818 | if (!_mcu.connected) { | 808 | if (!_mcu.connected) { |
| 819 | loger.warn(GlobalConfig.getCurrentStatus()); | 809 | loger.warn(GlobalConfig.getCurrentStatus()); |
| 820 | - return {"code":ApeConsts.RETURN_FAILED, "data":""}; | 810 | + return {"code": ApeConsts.RETURN_FAILED, "data": ""}; |
| 821 | } | 811 | } |
| 822 | if (_video_ape) { | 812 | if (_video_ape) { |
| 823 | return _video_ape.stopPublishVideo(_param); | 813 | return _video_ape.stopPublishVideo(_param); |
| @@ -835,7 +825,7 @@ export default class MessageEntrance extends Emiter { | @@ -835,7 +825,7 @@ export default class MessageEntrance extends Emiter { | ||
| 835 | sendAudioCommandMsg(_param) { | 825 | sendAudioCommandMsg(_param) { |
| 836 | if (!_mcu.connected) { | 826 | if (!_mcu.connected) { |
| 837 | loger.warn(GlobalConfig.getCurrentStatus()); | 827 | loger.warn(GlobalConfig.getCurrentStatus()); |
| 838 | - return {"code":ApeConsts.RETURN_FAILED, "data":""}; | 828 | + return {"code": ApeConsts.RETURN_FAILED, "data": ""}; |
| 839 | } | 829 | } |
| 840 | if (_audio_ape) { | 830 | if (_audio_ape) { |
| 841 | return _audio_ape.sendAudioBroadcastMsg(_param); | 831 | return _audio_ape.sendAudioBroadcastMsg(_param); |
| @@ -863,7 +853,7 @@ export default class MessageEntrance extends Emiter { | @@ -863,7 +853,7 @@ export default class MessageEntrance extends Emiter { | ||
| 863 | _publishAudio(_param) { | 853 | _publishAudio(_param) { |
| 864 | if (!_mcu.connected) { | 854 | if (!_mcu.connected) { |
| 865 | loger.warn(GlobalConfig.getCurrentStatus()); | 855 | loger.warn(GlobalConfig.getCurrentStatus()); |
| 866 | - return {"code":ApeConsts.RETURN_FAILED, "data":""}; | 856 | + return {"code": ApeConsts.RETURN_FAILED, "data": ""}; |
| 867 | } | 857 | } |
| 868 | if (_audio_ape) { | 858 | if (_audio_ape) { |
| 869 | return _audio_ape.publishAudio(_param); | 859 | return _audio_ape.publishAudio(_param); |
| @@ -873,7 +863,7 @@ export default class MessageEntrance extends Emiter { | @@ -873,7 +863,7 @@ export default class MessageEntrance extends Emiter { | ||
| 873 | _stopPublishAudio(_param) { | 863 | _stopPublishAudio(_param) { |
| 874 | if (!_mcu.connected) { | 864 | if (!_mcu.connected) { |
| 875 | loger.warn(GlobalConfig.getCurrentStatus()); | 865 | loger.warn(GlobalConfig.getCurrentStatus()); |
| 876 | - return {"code":ApeConsts.RETURN_FAILED, "data":""}; | 866 | + return {"code": ApeConsts.RETURN_FAILED, "data": ""}; |
| 877 | } | 867 | } |
| 878 | if (_audio_ape) { | 868 | if (_audio_ape) { |
| 879 | return _audio_ape.stopPublishAudio(_param); | 869 | return _audio_ape.stopPublishAudio(_param); |
| @@ -892,6 +882,7 @@ export default class MessageEntrance extends Emiter { | @@ -892,6 +882,7 @@ export default class MessageEntrance extends Emiter { | ||
| 892 | _whiteboard_ape.sendInsetAnnotaion(_param); | 882 | _whiteboard_ape.sendInsetAnnotaion(_param); |
| 893 | } | 883 | } |
| 894 | } | 884 | } |
| 885 | + | ||
| 895 | //删除当前页面上的所有标注 | 886 | //删除当前页面上的所有标注 |
| 896 | _sendDeleteCurPageAnnotation(_param) { | 887 | _sendDeleteCurPageAnnotation(_param) { |
| 897 | if (!_mcu.connected) { | 888 | if (!_mcu.connected) { |
| @@ -929,7 +920,7 @@ export default class MessageEntrance extends Emiter { | @@ -929,7 +920,7 @@ export default class MessageEntrance extends Emiter { | ||
| 929 | return _doc_ape.getDocFullAddress(_param); | 920 | return _doc_ape.getDocFullAddress(_param); |
| 930 | } else { | 921 | } else { |
| 931 | loger.error("文档模块还没有创建无法获取"); | 922 | loger.error("文档模块还没有创建无法获取"); |
| 932 | - return {"code":ApeConsts.RETURN_FAILED, "data": "文档模块还没有创建无法获取"}; | 923 | + return {"code": ApeConsts.RETURN_FAILED, "data": "文档模块还没有创建无法获取"}; |
| 933 | } | 924 | } |
| 934 | } | 925 | } |
| 935 | 926 | ||
| @@ -942,6 +933,7 @@ export default class MessageEntrance extends Emiter { | @@ -942,6 +933,7 @@ export default class MessageEntrance extends Emiter { | ||
| 942 | return []; | 933 | return []; |
| 943 | } | 934 | } |
| 944 | } | 935 | } |
| 936 | + | ||
| 945 | _getDocPDFFullPath(_param) { | 937 | _getDocPDFFullPath(_param) { |
| 946 | if (_doc_ape) { | 938 | if (_doc_ape) { |
| 947 | return _doc_ape.getDocPDFFullPath(_param); | 939 | return _doc_ape.getDocPDFFullPath(_param); |
| @@ -1019,7 +1011,7 @@ export default class MessageEntrance extends Emiter { | @@ -1019,7 +1011,7 @@ export default class MessageEntrance extends Emiter { | ||
| 1019 | 1011 | ||
| 1020 | //// 文档变更,白板也需要做处理 | 1012 | //// 文档变更,白板也需要做处理 |
| 1021 | docUpdateHandler(_data) { | 1013 | docUpdateHandler(_data) { |
| 1022 | - if (!_mcu.connected&&!GlobalConfig.isRecordPlayBack) { | 1014 | + if (!_mcu.connected && !GlobalConfig.isRecordPlayBack) { |
| 1023 | loger.warn(GlobalConfig.getCurrentStatus()); | 1015 | loger.warn(GlobalConfig.getCurrentStatus()); |
| 1024 | return; | 1016 | return; |
| 1025 | } | 1017 | } |
| @@ -1039,12 +1031,12 @@ export default class MessageEntrance extends Emiter { | @@ -1039,12 +1031,12 @@ export default class MessageEntrance extends Emiter { | ||
| 1039 | 1031 | ||
| 1040 | //文档加入频道成功,同步到MCU服务器上的数据 | 1032 | //文档加入频道成功,同步到MCU服务器上的数据 |
| 1041 | docJoinChannelSuccess() { | 1033 | docJoinChannelSuccess() { |
| 1042 | - loger.log("docJoinChannelSuccess->isHost=", GlobalConfig.isHost,"length=",GlobalConfig.docListPrepare.length); | 1034 | + loger.log("docJoinChannelSuccess->isHost=", GlobalConfig.isHost, "length=", GlobalConfig.docListPrepare.length); |
| 1043 | //loger.log("docJoinChannelSuccess docListPrepare="); | 1035 | //loger.log("docJoinChannelSuccess docListPrepare="); |
| 1044 | //如果是主持人,那么需要判断一下文档模块同步的数据和从sass获取的文档数据是否相同,如果mcu服务器不存在的,需要上传 | 1036 | //如果是主持人,那么需要判断一下文档模块同步的数据和从sass获取的文档数据是否相同,如果mcu服务器不存在的,需要上传 |
| 1045 | - if (GlobalConfig.isHost&&GlobalConfig.docListPrepare.length>0) { | ||
| 1046 | - for (let i=0;i<GlobalConfig.docListPrepare.length;i++) { | ||
| 1047 | - let value=GlobalConfig.docListPrepare[i]; | 1037 | + if (GlobalConfig.isHost && GlobalConfig.docListPrepare.length > 0) { |
| 1038 | + for (let i = 0; i < GlobalConfig.docListPrepare.length; i++) { | ||
| 1039 | + let value = GlobalConfig.docListPrepare[i]; | ||
| 1048 | if (value) { | 1040 | if (value) { |
| 1049 | //loger.log("判断是否需要把提前上传的文档上传到mcu", value); | 1041 | //loger.log("判断是否需要把提前上传的文档上传到mcu", value); |
| 1050 | let paramInfo = { | 1042 | let paramInfo = { |
| @@ -1066,7 +1058,7 @@ export default class MessageEntrance extends Emiter { | @@ -1066,7 +1058,7 @@ export default class MessageEntrance extends Emiter { | ||
| 1066 | 1058 | ||
| 1067 | //录制回放相关的处理------------------------------------------------ | 1059 | //录制回放相关的处理------------------------------------------------ |
| 1068 | //录制回放初始化 | 1060 | //录制回放初始化 |
| 1069 | - _initRecordPlayback(_param){ | 1061 | + _initRecordPlayback(_param) { |
| 1070 | //{"classId":"1653304953","portal":"112.126.80.182:80","userRole":"normal","userId":0} | 1062 | //{"classId":"1653304953","portal":"112.126.80.182:80","userRole":"normal","userId":0} |
| 1071 | if (_param == null) { | 1063 | if (_param == null) { |
| 1072 | loger.error('录制回放初始化失败,参数错误'); | 1064 | loger.error('录制回放初始化失败,参数错误'); |
| @@ -1082,10 +1074,10 @@ export default class MessageEntrance extends Emiter { | @@ -1082,10 +1074,10 @@ export default class MessageEntrance extends Emiter { | ||
| 1082 | loger.log('录制回放初始化->', _param); | 1074 | loger.log('录制回放初始化->', _param); |
| 1083 | 1075 | ||
| 1084 | //保存参数 | 1076 | //保存参数 |
| 1085 | - GlobalConfig.isRecordPlayBack=true;//设置为录制回放状态 | 1077 | + GlobalConfig.isRecordPlayBack = true;//设置为录制回放状态 |
| 1086 | GlobalConfig.classId = parseInt(_param.classId); | 1078 | GlobalConfig.classId = parseInt(_param.classId); |
| 1087 | GlobalConfig.portal = _param.portal; | 1079 | GlobalConfig.portal = _param.portal; |
| 1088 | - GlobalConfig.userRole =ApeConsts.normal;//*************很重要,录制回放的时候,身份模式是普通人******** | 1080 | + GlobalConfig.userRole = ApeConsts.normal;//*************很重要,录制回放的时候,身份模式是普通人******** |
| 1089 | GlobalConfig.userId = _param.userId || "0"; | 1081 | GlobalConfig.userId = _param.userId || "0"; |
| 1090 | GlobalConfig.userName = _param.userName || ""; | 1082 | GlobalConfig.userName = _param.userName || ""; |
| 1091 | 1083 | ||
| @@ -1101,18 +1093,21 @@ export default class MessageEntrance extends Emiter { | @@ -1101,18 +1093,21 @@ export default class MessageEntrance extends Emiter { | ||
| 1101 | _recordPlayback.startRecordPlayback(_param); | 1093 | _recordPlayback.startRecordPlayback(_param); |
| 1102 | } | 1094 | } |
| 1103 | } | 1095 | } |
| 1096 | + | ||
| 1104 | //停止录制回放 | 1097 | //停止录制回放 |
| 1105 | _stopRecordPlayback(_param) { | 1098 | _stopRecordPlayback(_param) { |
| 1106 | if (_recordPlayback) { | 1099 | if (_recordPlayback) { |
| 1107 | _recordPlayback.stopRecordPlayback(_param); | 1100 | _recordPlayback.stopRecordPlayback(_param); |
| 1108 | } | 1101 | } |
| 1109 | } | 1102 | } |
| 1103 | + | ||
| 1110 | //暂停录制回放 | 1104 | //暂停录制回放 |
| 1111 | _pauseRecordPlayback(_param) { | 1105 | _pauseRecordPlayback(_param) { |
| 1112 | if (_recordPlayback) { | 1106 | if (_recordPlayback) { |
| 1113 | _recordPlayback.pauseRecordPlayback(_param); | 1107 | _recordPlayback.pauseRecordPlayback(_param); |
| 1114 | } | 1108 | } |
| 1115 | } | 1109 | } |
| 1110 | + | ||
| 1116 | //seek录制回放 | 1111 | //seek录制回放 |
| 1117 | _seekRecordPlayback(_param) { | 1112 | _seekRecordPlayback(_param) { |
| 1118 | if (_recordPlayback) { | 1113 | if (_recordPlayback) { |
| @@ -1121,15 +1116,16 @@ export default class MessageEntrance extends Emiter { | @@ -1121,15 +1116,16 @@ export default class MessageEntrance extends Emiter { | ||
| 1121 | } | 1116 | } |
| 1122 | 1117 | ||
| 1123 | //录制回放状态更新 | 1118 | //录制回放状态更新 |
| 1124 | - _recordPlaybackClearDataHandler(_param){ | 1119 | + _recordPlaybackClearDataHandler(_param) { |
| 1125 | loger.log("_recordPlaybackClearDataHandler->") | 1120 | loger.log("_recordPlaybackClearDataHandler->") |
| 1126 | - if(_doc_ape){ | 1121 | + if (_doc_ape) { |
| 1127 | _doc_ape.clearData(); | 1122 | _doc_ape.clearData(); |
| 1128 | } | 1123 | } |
| 1129 | - if(_whiteboard_ape){ | 1124 | + if (_whiteboard_ape) { |
| 1130 | _whiteboard_ape.clearData(); | 1125 | _whiteboard_ape.clearData(); |
| 1131 | } | 1126 | } |
| 1132 | } | 1127 | } |
| 1128 | + | ||
| 1133 | //录制回放加入 课堂成功 | 1129 | //录制回放加入 课堂成功 |
| 1134 | _joinRecordPlaybackSuccessHandler(_data) { | 1130 | _joinRecordPlaybackSuccessHandler(_data) { |
| 1135 | loger.log('加入录制回放成功.'); | 1131 | loger.log('加入录制回放成功.'); |
| @@ -1138,12 +1134,12 @@ export default class MessageEntrance extends Emiter { | @@ -1138,12 +1134,12 @@ export default class MessageEntrance extends Emiter { | ||
| 1138 | //返回给客户端初始化成功的数据 | 1134 | //返回给客户端初始化成功的数据 |
| 1139 | let joinClassSuccessCallBackData = {}; | 1135 | let joinClassSuccessCallBackData = {}; |
| 1140 | 1136 | ||
| 1141 | - joinClassSuccessCallBackData.isRecordPlayBack=GlobalConfig.isRecordPlayBack; | 1137 | + joinClassSuccessCallBackData.isRecordPlayBack = GlobalConfig.isRecordPlayBack; |
| 1142 | 1138 | ||
| 1143 | joinClassSuccessCallBackData.DOCServerIP = GlobalConfig.DOCServerIP; | 1139 | joinClassSuccessCallBackData.DOCServerIP = GlobalConfig.DOCServerIP; |
| 1144 | joinClassSuccessCallBackData.DOCServerPort = GlobalConfig.DOCServerPort; | 1140 | joinClassSuccessCallBackData.DOCServerPort = GlobalConfig.DOCServerPort; |
| 1145 | 1141 | ||
| 1146 | - joinClassSuccessCallBackData.classStatus= GlobalConfig.classStatus; | 1142 | + joinClassSuccessCallBackData.classStatus = GlobalConfig.classStatus; |
| 1147 | joinClassSuccessCallBackData.classId = GlobalConfig.classId; | 1143 | joinClassSuccessCallBackData.classId = GlobalConfig.classId; |
| 1148 | joinClassSuccessCallBackData.className = GlobalConfig.className; | 1144 | joinClassSuccessCallBackData.className = GlobalConfig.className; |
| 1149 | joinClassSuccessCallBackData.h5Module = GlobalConfig.h5Module; | 1145 | joinClassSuccessCallBackData.h5Module = GlobalConfig.h5Module; |
| @@ -1178,13 +1174,13 @@ export default class MessageEntrance extends Emiter { | @@ -1178,13 +1174,13 @@ export default class MessageEntrance extends Emiter { | ||
| 1178 | joinClassSuccessCallBackData.province = GlobalConfig.province;//服务商 | 1174 | joinClassSuccessCallBackData.province = GlobalConfig.province;//服务商 |
| 1179 | joinClassSuccessCallBackData.isp = GlobalConfig.isp;//服务商 | 1175 | joinClassSuccessCallBackData.isp = GlobalConfig.isp;//服务商 |
| 1180 | 1176 | ||
| 1181 | - joinClassSuccessCallBackData.classTimestamp=GlobalConfig.classTimestamp;//课堂进行的累积时间 | ||
| 1182 | - joinClassSuccessCallBackData.recordTimestamp=GlobalConfig.recordTimestamp;//录制累积的总时间 | ||
| 1183 | - joinClassSuccessCallBackData.recordPlaybackMaxTime=GlobalConfig.recordPlaybackMaxTime;//录制回放的总时间 | 1177 | + joinClassSuccessCallBackData.classTimestamp = GlobalConfig.classTimestamp;//课堂进行的累积时间 |
| 1178 | + joinClassSuccessCallBackData.recordTimestamp = GlobalConfig.recordTimestamp;//录制累积的总时间 | ||
| 1179 | + joinClassSuccessCallBackData.recordPlaybackMaxTime = GlobalConfig.recordPlaybackMaxTime;//录制回放的总时间 | ||
| 1184 | 1180 | ||
| 1185 | - joinClassSuccessCallBackData.fps=GlobalConfig.fps; | ||
| 1186 | - joinClassSuccessCallBackData.gop=GlobalConfig.gop; | ||
| 1187 | - joinClassSuccessCallBackData.videoQuality=GlobalConfig.videoQuality; | 1181 | + joinClassSuccessCallBackData.fps = GlobalConfig.fps; |
| 1182 | + joinClassSuccessCallBackData.gop = GlobalConfig.gop; | ||
| 1183 | + joinClassSuccessCallBackData.videoQuality = GlobalConfig.videoQuality; | ||
| 1188 | 1184 | ||
| 1189 | loger.log(joinClassSuccessCallBackData); | 1185 | loger.log(joinClassSuccessCallBackData); |
| 1190 | //和加入课堂成功使用同样的消息处理 | 1186 | //和加入课堂成功使用同样的消息处理 |
| @@ -14,20 +14,20 @@ const loger = Loger.getLoger('ServerCheck'); | @@ -14,20 +14,20 @@ const loger = Loger.getLoger('ServerCheck'); | ||
| 14 | //ip选点流程的状态 | 14 | //ip选点流程的状态 |
| 15 | let isRequestMcuCallback = false;//是否获取最佳mcu返回 | 15 | let isRequestMcuCallback = false;//是否获取最佳mcu返回 |
| 16 | let isRequestMsCallback = false;//是否获取ms最佳返回 | 16 | let isRequestMsCallback = false;//是否获取ms最佳返回 |
| 17 | -let isTestFromSass=false; | ||
| 18 | -let isTestFromServer=false; | ||
| 19 | - | ||
| 20 | -let tempMcuIp=""; | ||
| 21 | -let tempMcuPort=""; | ||
| 22 | -let tempMsIp=""; | ||
| 23 | -let tempMsPort=""; | ||
| 24 | -let msDefaultPort="1935"; | ||
| 25 | -let mcuDefaultPort="7777"; | 17 | +let isTestFromSass = false; |
| 18 | +let isTestFromServer = false; | ||
| 19 | + | ||
| 20 | +let tempMcuIp = ""; | ||
| 21 | +let tempMcuPort = ""; | ||
| 22 | +let tempMsIp = ""; | ||
| 23 | +let tempMsPort = ""; | ||
| 24 | +let msDefaultPort = "1935"; | ||
| 25 | +let mcuDefaultPort = "7777"; | ||
| 26 | let speedTestPort = ':5555';//测速端口统一 | 26 | let speedTestPort = ':5555';//测速端口统一 |
| 27 | 27 | ||
| 28 | -let checkMcuIpGroup =[];//储存MCU需要查询的ip数组 | ||
| 29 | -let checkMsIpGroup =[];//储存MCU需要查询的ip数组 | ||
| 30 | -const timeOutDelay=1000;//选点超时 | 28 | +let checkMcuIpGroup = [];//储存MCU需要查询的ip数组 |
| 29 | +let checkMsIpGroup = [];//储存MCU需要查询的ip数组 | ||
| 30 | +const timeOutDelay = 1000;//选点超时 | ||
| 31 | 31 | ||
| 32 | class ServerCheck extends Emiter { | 32 | class ServerCheck extends Emiter { |
| 33 | constructor() { | 33 | constructor() { |
| @@ -40,25 +40,25 @@ class ServerCheck extends Emiter { | @@ -40,25 +40,25 @@ class ServerCheck extends Emiter { | ||
| 40 | //重置ip选点流程状态 | 40 | //重置ip选点流程状态 |
| 41 | isRequestMcuCallback = false; | 41 | isRequestMcuCallback = false; |
| 42 | isRequestMsCallback = false; | 42 | isRequestMsCallback = false; |
| 43 | - isTestFromSass=false; | ||
| 44 | - isTestFromServer=false; | ||
| 45 | - checkMcuIpGroup =[]; | ||
| 46 | - checkMsIpGroup =[]; | 43 | + isTestFromSass = false; |
| 44 | + isTestFromServer = false; | ||
| 45 | + checkMcuIpGroup = []; | ||
| 46 | + checkMsIpGroup = []; | ||
| 47 | let userIpInfo = new Object; | 47 | let userIpInfo = new Object; |
| 48 | userIpInfo.ret = -1; | 48 | userIpInfo.ret = -1; |
| 49 | 49 | ||
| 50 | let ip = userIp; | 50 | let ip = userIp; |
| 51 | - let md5Str = MD5("addr=" + ip + "&token=b657c3507b324353e09c1958ee956a98efceb3e3");//("addr=" + ip + "&token=b657c3507b324353e09c1958ee956a98efceb3e3"),转成MD5 | 51 | + let md5Str = MD5("addr=" + ip + "&token=b657c3507b324353e09c1958ee956a98efceb3e3"); |
| 52 | + // /("addr=" + ip + "&token=b657c3507b324353e09c1958ee956a98efceb3e3"),转成MD5 | ||
| 52 | let timestamp = new Date().getTime(); | 53 | let timestamp = new Date().getTime(); |
| 53 | let location = `http://ipapi.ipip.net/find?addr=${ip}&sid=14&uid=5237&sig=${md5Str}&_=${timestamp}`; | 54 | let location = `http://ipapi.ipip.net/find?addr=${ip}&sid=14&uid=5237&sig=${md5Str}&_=${timestamp}`; |
| 54 | - // loger.log('获取IP信息 ', userIp, location); | ||
| 55 | 55 | ||
| 56 | fetchJsonp(location, { | 56 | fetchJsonp(location, { |
| 57 | timeout: timeOutDelay, | 57 | timeout: timeOutDelay, |
| 58 | }).then(function (response) { | 58 | }).then(function (response) { |
| 59 | return response.json() | 59 | return response.json() |
| 60 | }).then(function (json) { | 60 | }).then(function (json) { |
| 61 | - // loger.log('获取IP信息返回', json) | 61 | + // loger.log('获取IP信息返回', json) |
| 62 | if (json) { | 62 | if (json) { |
| 63 | userIpInfo.ret = json.ret; | 63 | userIpInfo.ret = json.ret; |
| 64 | userIpInfo.country = json.data[0];//国家 | 64 | userIpInfo.country = json.data[0];//国家 |
| @@ -68,38 +68,38 @@ class ServerCheck extends Emiter { | @@ -68,38 +68,38 @@ class ServerCheck extends Emiter { | ||
| 68 | } | 68 | } |
| 69 | this.serverGetUserIpInfoCallback(userIpInfo); | 69 | this.serverGetUserIpInfoCallback(userIpInfo); |
| 70 | }.bind(this)).catch(function (ex) { | 70 | }.bind(this)).catch(function (ex) { |
| 71 | - // loger.log('获取IP信息失败', ex.message) | 71 | + // loger.log('获取IP信息失败', ex.message) |
| 72 | this.serverGetUserIpInfoCallback(userIpInfo); | 72 | this.serverGetUserIpInfoCallback(userIpInfo); |
| 73 | }.bind(this)); | 73 | }.bind(this)); |
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | //获取ip信息返回 | 76 | //获取ip信息返回 |
| 77 | serverGetUserIpInfoCallback(userIpInfo) { | 77 | serverGetUserIpInfoCallback(userIpInfo) { |
| 78 | - // loger.log("获取IP详情,开始处理", userIpInfo); | 78 | + // loger.log("获取IP详情,开始处理", userIpInfo); |
| 79 | if (userIpInfo.ret == "ok") { | 79 | if (userIpInfo.ret == "ok") { |
| 80 | GlobalConfig.country = userIpInfo.country;//国家 | 80 | GlobalConfig.country = userIpInfo.country;//国家 |
| 81 | GlobalConfig.city = userIpInfo.city;//城市 | 81 | GlobalConfig.city = userIpInfo.city;//城市 |
| 82 | GlobalConfig.province = userIpInfo.province;//服务商 | 82 | GlobalConfig.province = userIpInfo.province;//服务商 |
| 83 | GlobalConfig.isp = userIpInfo.isp;//服务商 | 83 | GlobalConfig.isp = userIpInfo.isp;//服务商 |
| 84 | - // loger.log("获取ip详情成功,country:" + GlobalConfig.country + ",city:" + GlobalConfig.city + ",isp:" + GlobalConfig.isp); | 84 | + // loger.log("获取ip详情成功,country:" + GlobalConfig.country + ",city:" + GlobalConfig.city + ",isp:" + GlobalConfig.isp); |
| 85 | this._chooseBestIpFromServer(); | 85 | this._chooseBestIpFromServer(); |
| 86 | } | 86 | } |
| 87 | else { | 87 | else { |
| 88 | - // loger.log("获取ip详情失败"); | 88 | + // loger.log("获取ip详情失败"); |
| 89 | this._chooseBestIpFromSassParam(); | 89 | this._chooseBestIpFromSassParam(); |
| 90 | } | 90 | } |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | //从IPIP服务列表中选择最快的IP | 93 | //从IPIP服务列表中选择最快的IP |
| 94 | _chooseBestIpFromServer() { | 94 | _chooseBestIpFromServer() { |
| 95 | - // loger.log("从Server服务列表中选择最快的IP"); | ||
| 96 | - isRequestMcuCallback=false; | ||
| 97 | - isRequestMsCallback=false; | ||
| 98 | - isTestFromServer=true; | ||
| 99 | - isTestFromSass=false; | 95 | + // loger.log("从Server服务列表中选择最快的IP"); |
| 96 | + isRequestMcuCallback = false; | ||
| 97 | + isRequestMsCallback = false; | ||
| 98 | + isTestFromServer = true; | ||
| 99 | + isTestFromSass = false; | ||
| 100 | 100 | ||
| 101 | //country, province, ctiy, isp, jsona | 101 | //country, province, ctiy, isp, jsona |
| 102 | - checkMcuIpGroup =this._returnServerMCU( | 102 | + checkMcuIpGroup = this._returnServerMCU( |
| 103 | GlobalConfig.country, | 103 | GlobalConfig.country, |
| 104 | GlobalConfig.province, | 104 | GlobalConfig.province, |
| 105 | GlobalConfig.city, | 105 | GlobalConfig.city, |
| @@ -113,34 +113,35 @@ class ServerCheck extends Emiter { | @@ -113,34 +113,35 @@ class ServerCheck extends Emiter { | ||
| 113 | GlobalConfig.isp, | 113 | GlobalConfig.isp, |
| 114 | Server.serverList); | 114 | Server.serverList); |
| 115 | 115 | ||
| 116 | - let mcuArr=[]; | ||
| 117 | - let msArr=[]; | ||
| 118 | - for(let i in checkMcuIpGroup){ | ||
| 119 | - if(checkMcuIpGroup[i]){ | ||
| 120 | - mcuArr.push(checkMcuIpGroup[i].ip+speedTestPort); | 116 | + let mcuArr = []; |
| 117 | + let msArr = []; | ||
| 118 | + for (let i in checkMcuIpGroup) { | ||
| 119 | + if (checkMcuIpGroup[i]) { | ||
| 120 | + mcuArr.push(checkMcuIpGroup[i].ip + speedTestPort); | ||
| 121 | } | 121 | } |
| 122 | } | 122 | } |
| 123 | - for(let k in checkMsIpGroup){ | ||
| 124 | - if(checkMsIpGroup[k]){ | ||
| 125 | - msArr.push(checkMsIpGroup[k].ip+speedTestPort); | 123 | + for (let k in checkMsIpGroup) { |
| 124 | + if (checkMsIpGroup[k]) { | ||
| 125 | + msArr.push(checkMsIpGroup[k].ip + speedTestPort); | ||
| 126 | } | 126 | } |
| 127 | } | 127 | } |
| 128 | this.getBestMcuServer(mcuArr); | 128 | this.getBestMcuServer(mcuArr); |
| 129 | this.getBestMsServer(msArr); | 129 | this.getBestMsServer(msArr); |
| 130 | } | 130 | } |
| 131 | + | ||
| 131 | //从Sass返回的msList mcuList中选点 | 132 | //从Sass返回的msList mcuList中选点 |
| 132 | _chooseBestIpFromSassParam() { | 133 | _chooseBestIpFromSassParam() { |
| 133 | - // loger.log("从Sass服务列表中选择最快的IP"); | 134 | + // loger.log("从Sass服务列表中选择最快的IP"); |
| 134 | isRequestMcuCallback = false; | 135 | isRequestMcuCallback = false; |
| 135 | isRequestMsCallback = false; | 136 | isRequestMsCallback = false; |
| 136 | - isTestFromSass=false; | ||
| 137 | - isTestFromServer=false; | ||
| 138 | - checkMcuIpGroup =GlobalConfig.mcuList; | ||
| 139 | - checkMsIpGroup =GlobalConfig.msList; | 137 | + isTestFromSass = false; |
| 138 | + isTestFromServer = false; | ||
| 139 | + checkMcuIpGroup = GlobalConfig.mcuList; | ||
| 140 | + checkMsIpGroup = GlobalConfig.msList; | ||
| 140 | //MCU | 141 | //MCU |
| 141 | let mcuIpGroup = []; | 142 | let mcuIpGroup = []; |
| 142 | for (let i = 0; i < checkMcuIpGroup.length; i++) { | 143 | for (let i = 0; i < checkMcuIpGroup.length; i++) { |
| 143 | - let ipPort = checkMcuIpGroup[i].ip+speedTestPort; | 144 | + let ipPort = checkMcuIpGroup[i].ip + speedTestPort; |
| 144 | mcuIpGroup.push(ipPort) | 145 | mcuIpGroup.push(ipPort) |
| 145 | } | 146 | } |
| 146 | this.getBestMcuServer(mcuIpGroup); | 147 | this.getBestMcuServer(mcuIpGroup); |
| @@ -148,7 +149,7 @@ class ServerCheck extends Emiter { | @@ -148,7 +149,7 @@ class ServerCheck extends Emiter { | ||
| 148 | //MS | 149 | //MS |
| 149 | let msIpGroup = []; | 150 | let msIpGroup = []; |
| 150 | for (let k = 0; k < checkMsIpGroup.length; k++) { | 151 | for (let k = 0; k < checkMsIpGroup.length; k++) { |
| 151 | - let ipPort = checkMsIpGroup[k].ip+speedTestPort; | 152 | + let ipPort = checkMsIpGroup[k].ip + speedTestPort; |
| 152 | msIpGroup.push(ipPort) | 153 | msIpGroup.push(ipPort) |
| 153 | } | 154 | } |
| 154 | this.getBestMsServer(msIpGroup); | 155 | this.getBestMsServer(msIpGroup); |
| @@ -157,26 +158,26 @@ class ServerCheck extends Emiter { | @@ -157,26 +158,26 @@ class ServerCheck extends Emiter { | ||
| 157 | 158 | ||
| 158 | //获取最快的MCU服务器地址,参数是一个ip数组 | 159 | //获取最快的MCU服务器地址,参数是一个ip数组 |
| 159 | getBestMcuServer(_param) { | 160 | getBestMcuServer(_param) { |
| 160 | - // loger.log('开始MCU选点 ', _param); | ||
| 161 | - if(_param==null||_param.length<1){ | ||
| 162 | - this._getBestMcuServerCallbackHandler("") | 161 | + // loger.log('开始MCU选点 ', _param); |
| 162 | + if (_param == null || _param.length < 1) { | ||
| 163 | + this._getBestMcuServerCallbackHandler(""); | ||
| 163 | return; | 164 | return; |
| 164 | } | 165 | } |
| 165 | iphunter(_param, function (fatest_ip_response) { | 166 | iphunter(_param, function (fatest_ip_response) { |
| 166 | if (!fatest_ip_response) { | 167 | if (!fatest_ip_response) { |
| 167 | loger.warn('getBestMcuServer -> nothing!'); | 168 | loger.warn('getBestMcuServer -> nothing!'); |
| 168 | - this._getBestMcuServerCallbackHandler("") | 169 | + this._getBestMcuServerCallbackHandler(""); |
| 169 | } else { | 170 | } else { |
| 170 | loger.log('getBestMcuServer done -> ', fatest_ip_response); | 171 | loger.log('getBestMcuServer done -> ', fatest_ip_response); |
| 171 | - this._getBestMcuServerCallbackHandler(fatest_ip_response) | 172 | + this._getBestMcuServerCallbackHandler(fatest_ip_response); |
| 172 | } | 173 | } |
| 173 | }.bind(this), timeOutDelay); | 174 | }.bind(this), timeOutDelay); |
| 174 | } | 175 | } |
| 175 | 176 | ||
| 176 | //获取最快的MS服务器地址,参数是一个ip数组 | 177 | //获取最快的MS服务器地址,参数是一个ip数组 |
| 177 | getBestMsServer(_param) { | 178 | getBestMsServer(_param) { |
| 178 | - // loger.log('开始MS选点 ', _param); | ||
| 179 | - if(_param==null||_param.length<1){ | 179 | + // loger.log('开始MS选点 ', _param); |
| 180 | + if (_param == null || _param.length < 1) { | ||
| 180 | this._getBestMsServerCallbackHandler("") | 181 | this._getBestMsServerCallbackHandler("") |
| 181 | return; | 182 | return; |
| 182 | } | 183 | } |
| @@ -192,50 +193,50 @@ class ServerCheck extends Emiter { | @@ -192,50 +193,50 @@ class ServerCheck extends Emiter { | ||
| 192 | } | 193 | } |
| 193 | 194 | ||
| 194 | _getBestMcuServerCallbackHandler(_data) { | 195 | _getBestMcuServerCallbackHandler(_data) { |
| 195 | - // loger.log("MCU选点返回1", _data); | 196 | + // loger.log("MCU选点返回1", _data); |
| 196 | if (isRequestMcuCallback) { | 197 | if (isRequestMcuCallback) { |
| 197 | - // loger.log("MCU选点,已经有返回"); | 198 | + // loger.log("MCU选点,已经有返回"); |
| 198 | return; | 199 | return; |
| 199 | } | 200 | } |
| 200 | isRequestMcuCallback = true; | 201 | isRequestMcuCallback = true; |
| 201 | if (_data) { | 202 | if (_data) { |
| 202 | let server = _data.split(":"); | 203 | let server = _data.split(":"); |
| 203 | if (server[0]) { | 204 | if (server[0]) { |
| 204 | - tempMcuIp= server[0]; | 205 | + tempMcuIp = server[0]; |
| 205 | } | 206 | } |
| 206 | - tempMcuPort=mcuDefaultPort; | ||
| 207 | - for(let i=0;i<checkMcuIpGroup.length;i++){ | ||
| 208 | - if(tempMcuIp==checkMcuIpGroup[i].ip){ | ||
| 209 | - tempMcuPort=checkMcuIpGroup[i].port||mcuDefaultPort; | 207 | + tempMcuPort = mcuDefaultPort; |
| 208 | + for (let i = 0; i < checkMcuIpGroup.length; i++) { | ||
| 209 | + if (tempMcuIp == checkMcuIpGroup[i].ip) { | ||
| 210 | + tempMcuPort = checkMcuIpGroup[i].port || mcuDefaultPort; | ||
| 210 | break; | 211 | break; |
| 211 | } | 212 | } |
| 212 | } | 213 | } |
| 213 | } | 214 | } |
| 214 | - // loger.log("MCU选点返回2",tempMcuIp,tempMcuPort); | 215 | + // loger.log("MCU选点返回2",tempMcuIp,tempMcuPort); |
| 215 | this._startConnectMcu(); | 216 | this._startConnectMcu(); |
| 216 | } | 217 | } |
| 217 | 218 | ||
| 218 | _getBestMsServerCallbackHandler(_data) { | 219 | _getBestMsServerCallbackHandler(_data) { |
| 219 | - // loger.log("MS选点返回1", _data); | 220 | + // loger.log("MS选点返回1", _data); |
| 220 | if (isRequestMsCallback) { | 221 | if (isRequestMsCallback) { |
| 221 | - // loger.log("_getBestMsServerCallbackHandler,已经有返回"); | 222 | + // loger.log("_getBestMsServerCallbackHandler,已经有返回"); |
| 222 | return; | 223 | return; |
| 223 | } | 224 | } |
| 224 | isRequestMsCallback = true; | 225 | isRequestMsCallback = true; |
| 225 | if (_data) { | 226 | if (_data) { |
| 226 | let server = _data.split(":"); | 227 | let server = _data.split(":"); |
| 227 | if (server[0]) { | 228 | if (server[0]) { |
| 228 | - tempMsIp= server[0]; | 229 | + tempMsIp = server[0]; |
| 229 | } | 230 | } |
| 230 | - tempMsPort=msDefaultPort; | ||
| 231 | - for(let i=0;i<checkMsIpGroup.length;i++){ | ||
| 232 | - if(tempMsIp==checkMsIpGroup[i].ip){ | ||
| 233 | - tempMsPort=checkMsIpGroup[i].port||msDefaultPort; | 231 | + tempMsPort = msDefaultPort; |
| 232 | + for (let i = 0; i < checkMsIpGroup.length; i++) { | ||
| 233 | + if (tempMsIp == checkMsIpGroup[i].ip) { | ||
| 234 | + tempMsPort = checkMsIpGroup[i].port || msDefaultPort; | ||
| 234 | break; | 235 | break; |
| 235 | } | 236 | } |
| 236 | } | 237 | } |
| 237 | } | 238 | } |
| 238 | - // loger.log("MS选点返回2", tempMsIp,tempMsPort); | 239 | + // loger.log("MS选点返回2", tempMsIp,tempMsPort); |
| 239 | this._startConnectMcu(); | 240 | this._startConnectMcu(); |
| 240 | } | 241 | } |
| 241 | 242 | ||
| @@ -244,27 +245,27 @@ class ServerCheck extends Emiter { | @@ -244,27 +245,27 @@ class ServerCheck extends Emiter { | ||
| 244 | if (isRequestMcuCallback && isRequestMsCallback) { | 245 | if (isRequestMcuCallback && isRequestMsCallback) { |
| 245 | if (isTestFromServer && !isTestFromSass) { | 246 | if (isTestFromServer && !isTestFromSass) { |
| 246 | //从Server服务列表中选点结束,如果没有选到合适的,从Sass的列表中获取 | 247 | //从Server服务列表中选点结束,如果没有选到合适的,从Sass的列表中获取 |
| 247 | - if(!tempMcuIp||!tempMsIp){ | 248 | + if (!tempMcuIp || !tempMsIp) { |
| 248 | this._chooseBestIpFromSassParam(); | 249 | this._chooseBestIpFromSassParam(); |
| 249 | - }else { | ||
| 250 | - GlobalConfig.MCUServerIP=tempMcuIp; | ||
| 251 | - GlobalConfig.MCUServerPort=tempMcuPort; | ||
| 252 | - GlobalConfig.MSServerIP=tempMsIp; | ||
| 253 | - GlobalConfig.MSServerPort=tempMsPort; | ||
| 254 | - // loger.log("Server选点完成", "mcu-->",GlobalConfig.MCUServerIP,GlobalConfig.MCUServerPort,"ms---->",GlobalConfig.MSServerIP,GlobalConfig.MSServerPort); | 250 | + } else { |
| 251 | + GlobalConfig.MCUServerIP = tempMcuIp; | ||
| 252 | + GlobalConfig.MCUServerPort = tempMcuPort; | ||
| 253 | + GlobalConfig.MSServerIP = tempMsIp; | ||
| 254 | + GlobalConfig.MSServerPort = tempMsPort; | ||
| 255 | + // loger.log("Server选点完成", "mcu-->",GlobalConfig.MCUServerIP,GlobalConfig.MCUServerPort,"ms---->",GlobalConfig.MSServerIP,GlobalConfig.MSServerPort); | ||
| 255 | this._emit(ServerCheck.SEVER_CHECK_BEST_IP_SUCCESS); | 256 | this._emit(ServerCheck.SEVER_CHECK_BEST_IP_SUCCESS); |
| 256 | } | 257 | } |
| 257 | } else { | 258 | } else { |
| 258 | //从Sass返回的服务列表中选点结束 | 259 | //从Sass返回的服务列表中选点结束 |
| 259 | - if(tempMcuIp){ | ||
| 260 | - GlobalConfig.MCUServerIP=tempMcuIp; | ||
| 261 | - GlobalConfig.MCUServerPort=tempMcuPort; | 260 | + if (tempMcuIp) { |
| 261 | + GlobalConfig.MCUServerIP = tempMcuIp; | ||
| 262 | + GlobalConfig.MCUServerPort = tempMcuPort; | ||
| 262 | } | 263 | } |
| 263 | - if(tempMsIp){ | ||
| 264 | - GlobalConfig.MSServerIP=tempMsIp; | ||
| 265 | - GlobalConfig.MSServerPort=tempMsPort; | 264 | + if (tempMsIp) { |
| 265 | + GlobalConfig.MSServerIP = tempMsIp; | ||
| 266 | + GlobalConfig.MSServerPort = tempMsPort; | ||
| 266 | } | 267 | } |
| 267 | - loger.log("Sass选点完成", "mcu-->",GlobalConfig.MCUServerIP,GlobalConfig.MCUServerPort,"ms---->",GlobalConfig.MSServerIP,GlobalConfig.MSServerPort); | 268 | + loger.log("Sass选点完成", "mcu-->", GlobalConfig.MCUServerIP, GlobalConfig.MCUServerPort, "ms---->", GlobalConfig.MSServerIP, GlobalConfig.MSServerPort); |
| 268 | this._emit(ServerCheck.SEVER_CHECK_BEST_IP_SUCCESS); | 269 | this._emit(ServerCheck.SEVER_CHECK_BEST_IP_SUCCESS); |
| 269 | } | 270 | } |
| 270 | } else { | 271 | } else { |
| @@ -274,44 +275,44 @@ class ServerCheck extends Emiter { | @@ -274,44 +275,44 @@ class ServerCheck extends Emiter { | ||
| 274 | 275 | ||
| 275 | //检测MCU连接地址 | 276 | //检测MCU连接地址 |
| 276 | _returnServerMCU(country, province, ctiy, isp, jsona) { | 277 | _returnServerMCU(country, province, ctiy, isp, jsona) { |
| 277 | - let countryData=jsona.MCU[country]; | 278 | + let countryData = jsona.MCU[country]; |
| 278 | //按country没有查找到就返回default | 279 | //按country没有查找到就返回default |
| 279 | - if(!countryData){ | ||
| 280 | - countryData=jsona.MCU.default; | ||
| 281 | - // loger.log("_returnServerMCU->countryData->default",countryData); | 280 | + if (!countryData) { |
| 281 | + countryData = jsona.MCU.default; | ||
| 282 | + // loger.log("_returnServerMCU->countryData->default",countryData); | ||
| 282 | return countryData; | 283 | return countryData; |
| 283 | } | 284 | } |
| 284 | 285 | ||
| 285 | - if(country!="中国"){ | ||
| 286 | - // loger.log("_returnServerMCU->countryData",countryData); | 286 | + if (country != "中国") { |
| 287 | + // loger.log("_returnServerMCU->countryData",countryData); | ||
| 287 | return countryData; | 288 | return countryData; |
| 288 | } | 289 | } |
| 289 | 290 | ||
| 290 | //中国的需要细分 | 291 | //中国的需要细分 |
| 291 | //按isp查找 | 292 | //按isp查找 |
| 292 | - let ispData=countryData.isp[isp]; | 293 | + let ispData = countryData.isp[isp]; |
| 293 | //isp查找到就返回 | 294 | //isp查找到就返回 |
| 294 | - if(ispData){ | ||
| 295 | - // loger.log("_returnServerMCU->ispData",ispData); | 295 | + if (ispData) { |
| 296 | + // loger.log("_returnServerMCU->ispData",ispData); | ||
| 296 | return ispData; | 297 | return ispData; |
| 297 | } | 298 | } |
| 298 | 299 | ||
| 299 | //isp没查找到,用province | 300 | //isp没查找到,用province |
| 300 | - let provinceData=countryData.province[province]; | 301 | + let provinceData = countryData.province[province]; |
| 301 | //用province查找到就返回 | 302 | //用province查找到就返回 |
| 302 | - if(provinceData){ | ||
| 303 | - // loger.log("_returnServerMCU->provinceData",provinceData); | 303 | + if (provinceData) { |
| 304 | + // loger.log("_returnServerMCU->provinceData",provinceData); | ||
| 304 | return provinceData; | 305 | return provinceData; |
| 305 | } | 306 | } |
| 306 | 307 | ||
| 307 | 308 | ||
| 308 | //isp province都没有,使用default | 309 | //isp province都没有,使用default |
| 309 | - let defaultData=countryData.default | ||
| 310 | - if(defaultData){ | ||
| 311 | - // loger.log("_returnServerMCU->defaultData",defaultData); | 310 | + let defaultData = countryData.default |
| 311 | + if (defaultData) { | ||
| 312 | + // loger.log("_returnServerMCU->defaultData",defaultData); | ||
| 312 | return defaultData; | 313 | return defaultData; |
| 313 | - }else { | ||
| 314 | - // loger.log("_returnServerMCU->defaultData",""); | 314 | + } else { |
| 315 | + // loger.log("_returnServerMCU->defaultData",""); | ||
| 315 | return []; | 316 | return []; |
| 316 | } | 317 | } |
| 317 | return []; | 318 | return []; |
| @@ -320,44 +321,44 @@ class ServerCheck extends Emiter { | @@ -320,44 +321,44 @@ class ServerCheck extends Emiter { | ||
| 320 | //检测MS连接地址 | 321 | //检测MS连接地址 |
| 321 | //Config.ipInfo | 322 | //Config.ipInfo |
| 322 | _returnServerMS(country, province, ctiy, isp, jsona) { | 323 | _returnServerMS(country, province, ctiy, isp, jsona) { |
| 323 | - let countryData=jsona.MS[country]; | 324 | + let countryData = jsona.MS[country]; |
| 324 | //按country没有查找到就返回default | 325 | //按country没有查找到就返回default |
| 325 | - if(!countryData){ | ||
| 326 | - countryData=jsona.MS.default; | ||
| 327 | - // loger.log("_returnServerMS->countryData->default",countryData); | 326 | + if (!countryData) { |
| 327 | + countryData = jsona.MS.default; | ||
| 328 | + // loger.log("_returnServerMS->countryData->default",countryData); | ||
| 328 | return countryData; | 329 | return countryData; |
| 329 | } | 330 | } |
| 330 | 331 | ||
| 331 | - if(country!="中国"){ | ||
| 332 | - // loger.log("_returnServerMS->countryData",countryData); | 332 | + if (country != "中国") { |
| 333 | + // loger.log("_returnServerMS->countryData",countryData); | ||
| 333 | return countryData; | 334 | return countryData; |
| 334 | } | 335 | } |
| 335 | 336 | ||
| 336 | //中国的需要细分 | 337 | //中国的需要细分 |
| 337 | //按isp查找 | 338 | //按isp查找 |
| 338 | - let ispData=countryData.isp[isp]; | 339 | + let ispData = countryData.isp[isp]; |
| 339 | //isp查找到就返回 | 340 | //isp查找到就返回 |
| 340 | - if(ispData){ | ||
| 341 | - // loger.log("_returnServerMS->ispData",ispData); | 341 | + if (ispData) { |
| 342 | + // loger.log("_returnServerMS->ispData",ispData); | ||
| 342 | return ispData; | 343 | return ispData; |
| 343 | } | 344 | } |
| 344 | 345 | ||
| 345 | //isp没查找到,用province | 346 | //isp没查找到,用province |
| 346 | - let provinceData=countryData.province[province]; | 347 | + let provinceData = countryData.province[province]; |
| 347 | //用province查找到就返回 | 348 | //用province查找到就返回 |
| 348 | - if(provinceData){ | ||
| 349 | - // loger.log("_returnServerMS->provinceData",provinceData); | 349 | + if (provinceData) { |
| 350 | + // loger.log("_returnServerMS->provinceData",provinceData); | ||
| 350 | return provinceData; | 351 | return provinceData; |
| 351 | } | 352 | } |
| 352 | 353 | ||
| 353 | 354 | ||
| 354 | //isp province都没有,使用default | 355 | //isp province都没有,使用default |
| 355 | - let defaultData=countryData.default | ||
| 356 | - if(defaultData){ | ||
| 357 | - // loger.log("_returnServerMS->defaultData",defaultData); | 356 | + let defaultData = countryData.default |
| 357 | + if (defaultData) { | ||
| 358 | + // loger.log("_returnServerMS->defaultData",defaultData); | ||
| 358 | return defaultData; | 359 | return defaultData; |
| 359 | - }else { | ||
| 360 | - // loger.log("_returnServerMS->defaultData",""); | 360 | + } else { |
| 361 | + // loger.log("_returnServerMS->defaultData",""); | ||
| 361 | return []; | 362 | return []; |
| 362 | } | 363 | } |
| 363 | 364 |
-
请 注册 或 登录 后发表评论