|
@ -266,8 +266,40 @@ class Participants extends RedisModel {
|
|
|
log.info("changUserRedisLoginStatus,userid:"+userid)
|
|
|
log.info("changUserRedisLoginStatus,userid:"+userid)
|
|
|
log.info("changUserRedisLoginStatus,userid:"+userid)
|
|
|
|
|
|
if(sessionId != "system"){
|
|
|
this.emitSessionUsers(sessionId,userid,"online");
|
|
|
if(status==1){
|
|
|
this.emitSessionUsers(sessionId,userid,"online");
|
|
|
}else if(status==0) {
|
|
|
this.emitSessionUsers(sessionId,userid,"offline");
|
|
|
}
|
|
|
}else {
|
|
|
if(status==0){
|
|
|
let arr = userid.split("_");
|
|
|
let userId = arr[arr.length-1]
|
|
|
//修改用户状态
|
|
|
Users.isPatientId(userId, function (err, isPatient) {
|
|
|
if (isPatient) {
|
|
|
log.info("修改患者状态"+status+"======"+userId)
|
|
|
Users.updatePatientStatus(userId,status);
|
|
|
} else {
|
|
|
log.info("修改医生状态"+status+"======"+userId)
|
|
|
Users.updateDoctorStatus(userId,status);
|
|
|
}
|
|
|
});
|
|
|
}else {
|
|
|
//修改用户状态
|
|
|
Users.isPatientId(userid, function (err, isPatient) {
|
|
|
if (isPatient) {
|
|
|
log.info("修改患者状态"+status+"======"+userid)
|
|
|
Users.updatePatientStatus(userid,status);
|
|
|
} else {
|
|
|
log.info("修改医生状态"+status+"======"+userid)
|
|
|
Users.updateDoctorStatus(userid,status);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
@ -306,6 +338,18 @@ class Participants extends RedisModel {
|
|
|
if(pc_patientClient){
|
|
|
pc_patientClient.socket.emit('message', message);
|
|
|
}
|
|
|
/*Users.updatePatientStatus(participant.id,status,function(err,sqlResult){
|
|
|
if(handler){
|
|
|
handler(err,sqlResult);
|
|
|
return;
|
|
|
}
|
|
|
if(err){
|
|
|
logger.error("set session status to mysql is error !");
|
|
|
}else{
|
|
|
logger.info("set session status is success");
|
|
|
ModelUtil.emitOK(self.eventEmitter, []);
|
|
|
}
|
|
|
});*/
|
|
|
} else {
|
|
|
log.info("emitSessionUsers:isdoctor"+participant.id);
|
|
|
let doctorClient = clientCache.findByIdAndType(participant.id,SOCKET_TYPES.DOCTOR);
|
|
@ -316,6 +360,19 @@ class Participants extends RedisModel {
|
|
|
if(pc_doctorClient){
|
|
|
pc_doctorClient.socket.emit('message',message);
|
|
|
}
|
|
|
/*log.info("修改医生状态"+status+"======"+participant.id)
|
|
|
Users.updateDoctorStatus(participant.id,status,function(err,sqlResult){
|
|
|
if(handler){
|
|
|
handler(err,sqlResult);
|
|
|
return;
|
|
|
}
|
|
|
if(err){
|
|
|
logger.error("set session status to mysql is error !");
|
|
|
}else{
|
|
|
logger.info("set session status is success");
|
|
|
ModelUtil.emitOK(self.eventEmitter, []);
|
|
|
}
|
|
|
});*/
|
|
|
}
|
|
|
});
|
|
|
})
|