|
@ -66,6 +66,10 @@ class SocketHandler {
|
|
|
socket.emit('ack', {});
|
|
|
});
|
|
|
}else{
|
|
|
|
|
|
//原始登陆者ID
|
|
|
let original_login_userid = data.userId;
|
|
|
|
|
|
if("pc_doctor"===data.clientType){//新增pc端医生登录
|
|
|
data.userId = "pc_"+data.userId;
|
|
|
}else if("pc_doctor_system"===data.clientType){//新增pc端医生外层-登录类型-20191012-huangnwenjie
|
|
@ -96,6 +100,8 @@ class SocketHandler {
|
|
|
patientClient.sessionId = data.sessionId||"";
|
|
|
clientCache.addClient(patientClient);
|
|
|
users.login(data.userId, 10, '', '');
|
|
|
//修改居民在线状态
|
|
|
users.changUserRedisLoginStatus(original_login_userid,data.clientType,1);
|
|
|
socket.emit('ack', {});
|
|
|
}else if("pc_patient"===data.clientType || "pc_patient_system"===data.clientType){////新增居民PC外层-登陆类型-20191012-huangnwenjie
|
|
|
//用于pcpatient 消息通知
|
|
@ -106,6 +112,8 @@ class SocketHandler {
|
|
|
pcpatientClient.sessionId = data.sessionId||"";
|
|
|
clientCache.addClient(pcpatientClient);
|
|
|
users.login(data.userId, 10, '', '');
|
|
|
//修改居民在线状态
|
|
|
users.changUserRedisLoginStatus(original_login_userid,data.clientType,1);
|
|
|
socket.emit('ack', {});
|
|
|
//MDT 登陆类型已迁移到上面的分支-20191012-huangnwenjie
|
|
|
// }else if("pcim_doctor"===data.clientType){ 登
|
|
@ -124,6 +132,8 @@ class SocketHandler {
|
|
|
doctorClient.clientType = data.clientType;
|
|
|
doctorClient.sessionId = data.sessionId||"";
|
|
|
clientCache.addClient(doctorClient);
|
|
|
//修改医生在线状态
|
|
|
users.changUserRedisLoginStatus(original_login_userid,data.clientType,1);
|
|
|
socket.emit('ack', {});
|
|
|
}
|
|
|
}
|
|
@ -296,6 +306,11 @@ class SocketHandler {
|
|
|
});
|
|
|
|
|
|
socket.on('error',function(errMsg){
|
|
|
let client = clientCache.findBySocket(socket);
|
|
|
if (client) {
|
|
|
//修改居民在线状态
|
|
|
users.changUserRedisLoginStatus(original_login_userid,client.clientType,0);
|
|
|
}
|
|
|
log.info(JSON.stringify(errMsg));
|
|
|
socket.emit(errMsg);
|
|
|
});
|
|
@ -304,6 +319,8 @@ class SocketHandler {
|
|
|
socket.on('logout', function (data) {
|
|
|
let client = clientCache.findBySocket(socket);
|
|
|
if (client) {
|
|
|
//修改居民在线状态
|
|
|
users.changUserRedisLoginStatus(original_login_userid,client.clientType,0);
|
|
|
log.info('User logout: ' + client.userId);
|
|
|
clientCache.removeByUserId(client.userId);
|
|
|
}
|
|
@ -313,6 +330,8 @@ class SocketHandler {
|
|
|
socket.on('disconnect', function (soc) {
|
|
|
let patientClient = clientCache.findBySocket(socket);
|
|
|
if (patientClient) {
|
|
|
//修改居民在线状态
|
|
|
users.changUserRedisLoginStatus(original_login_userid,client.clientType,0);
|
|
|
log.info("User disconnect: ", patientClient.userId);
|
|
|
clientCache.removeByUserSocket(socket);
|
|
|
}
|