|
@ -70,6 +70,7 @@ class OnlineCache{
|
|
|
|
|
|
//新增用户,判断用户是否在线,在线人数统计
|
|
//新增用户,判断用户是否在线,在线人数统计
|
|
addUser(userId,type) {
|
|
addUser(userId,type) {
|
|
|
|
userId = this.repalceUserId(userId);
|
|
let key = userId+":"+type;
|
|
let key = userId+":"+type;
|
|
let count = this.findByIdAndType(userId,type);
|
|
let count = this.findByIdAndType(userId,type);
|
|
if(count&&count>0){
|
|
if(count&&count>0){
|
|
@ -121,6 +122,37 @@ class OnlineCache{
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
findByUserIdAndType(userId,type){
|
|
|
|
if("helper" == type){
|
|
|
|
return this._helperMap.get(userId);
|
|
|
|
}
|
|
|
|
if("teacher" == type){
|
|
|
|
return this._teacherMap.get(userId);
|
|
|
|
}
|
|
|
|
if("child" == type){
|
|
|
|
return this._childMap.get(userId);
|
|
|
|
}
|
|
|
|
if("older"==type){
|
|
|
|
let older = this._olderWxMap.get(userId);
|
|
|
|
if(older){
|
|
|
|
return older
|
|
|
|
}else{
|
|
|
|
return this._olderPadMap.get(userId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
repalceUserId(userId){
|
|
|
|
if(userId == "" || userId == undefined || userId == null){
|
|
|
|
return userId;
|
|
|
|
}
|
|
|
|
userId = userId.replace(/pc_system_/, "");
|
|
|
|
userId = userId.replace(/pcpatient_system_/, "");
|
|
|
|
userId = userId.replace(/patient_system_/, "");
|
|
|
|
userId = userId.replace(/doctor_system_/, "");
|
|
|
|
return userId;
|
|
|
|
}
|
|
|
|
|
|
//用户断线,判断用户是否在线,在线人数统计
|
|
//用户断线,判断用户是否在线,在线人数统计
|
|
removeUser(userId,type){
|
|
removeUser(userId,type){
|
|
@ -128,6 +160,7 @@ class OnlineCache{
|
|
log.info(type+"--离线--");
|
|
log.info(type+"--离线--");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
userId = this.repalceUserId(userId);
|
|
let key = userId+":"+type;
|
|
let key = userId+":"+type;
|
|
let count = this.findByIdAndType(userId,type);
|
|
let count = this.findByIdAndType(userId,type);
|
|
if(count&&count>1){
|
|
if(count&&count>1){
|