|
@ -314,8 +314,7 @@ class WechatClient extends RedisModel {
|
|
// }
|
|
// }
|
|
|
|
|
|
var count = 0;
|
|
var count = 0;
|
|
// if(doctorClient&&message.session_id==doctorClient.sessionId){
|
|
|
|
if(doctorClient){
|
|
|
|
|
|
if(doctorClient&&message.session_id==doctorClient.sessionId){
|
|
WechatClient.updateParticipantLastFetchTime(doctorClient.sessionId, doctorId, ObjectUtil.timestampToLong(message.timestamp));
|
|
WechatClient.updateParticipantLastFetchTime(doctorClient.sessionId, doctorId, ObjectUtil.timestampToLong(message.timestamp));
|
|
doctorClient.socket.emit('message', {
|
|
doctorClient.socket.emit('message', {
|
|
id: message.id,
|
|
id: message.id,
|
|
@ -333,7 +332,7 @@ class WechatClient extends RedisModel {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
//发送pc端
|
|
|
|
|
|
//发送pc端 - PC端消息不做sessionid的判断,前端自己判断消息归属于哪个会话,自行渲染--20191012-huangwenjie
|
|
// if(pc_doctorClient&&message.session_id==pc_doctorClient.sessionId){
|
|
// if(pc_doctorClient&&message.session_id==pc_doctorClient.sessionId){
|
|
if(pc_doctorClient){
|
|
if(pc_doctorClient){
|
|
WechatClient.updateParticipantLastFetchTime(pc_doctorClient.sessionId, doctorId, ObjectUtil.timestampToLong(message.timestamp));
|
|
WechatClient.updateParticipantLastFetchTime(pc_doctorClient.sessionId, doctorId, ObjectUtil.timestampToLong(message.timestamp));
|
|
@ -444,6 +443,111 @@ class WechatClient extends RedisModel {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//推送居民、居民PC、医生、医生PC外层推送
|
|
|
|
static sendSystemSocketMessage(targetUserId, message) {
|
|
|
|
|
|
|
|
//居民外层消息推送
|
|
|
|
|
|
|
|
let patientClient = clientCache.findByIdAndType("patient_system_"+targetUserId,SOCKET_TYPES.PATIENT_SYSTEM);
|
|
|
|
let pc_patientClient = clientCache.findByIdAndType("pcpatient_system_"+targetUserId,SOCKET_TYPES.PC_PATIENT_SYSTEM);
|
|
|
|
if(!patientClient&&!pc_patientClient){
|
|
|
|
log.warn("target patient systemt is not online!");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var patientcount = 0;
|
|
|
|
if(patientClient&&message.session_id==patientClient.sessionId){
|
|
|
|
WechatClient.updateParticipantLastFetchTime(patientClient.sessionId, targetUserId, ObjectUtil.timestampToLong(message.timestamp));
|
|
|
|
patientClient.socket.emit('message', {
|
|
|
|
id: message.id,
|
|
|
|
session_id: message.session_id,
|
|
|
|
sender_id: message.sender_id,
|
|
|
|
sender_name: message.sender_name,
|
|
|
|
content_type: message.content_type,
|
|
|
|
content: message.content,
|
|
|
|
timestamp: ObjectUtil.timestampToLong(message.timestamp),
|
|
|
|
type: message.content_type, // legacy support
|
|
|
|
name: message.sender_name,
|
|
|
|
});
|
|
|
|
}else{
|
|
|
|
patientcount++;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//发送pc端
|
|
|
|
if(pc_patientClient&&message.session_id==pc_patientClient.sessionId){
|
|
|
|
WechatClient.updateParticipantLastFetchTime(pc_patientClient.sessionId, targetUserId, ObjectUtil.timestampToLong(message.timestamp));
|
|
|
|
pc_patientClient.socket.emit('message', {
|
|
|
|
id: message.id,
|
|
|
|
session_id: message.session_id,
|
|
|
|
sender_id: message.sender_id,
|
|
|
|
sender_name: message.sender_name,
|
|
|
|
content_type: message.content_type,
|
|
|
|
content: message.content,
|
|
|
|
timestamp: ObjectUtil.timestampToLong(message.timestamp),
|
|
|
|
type: message.content_type, // legacy support
|
|
|
|
name: message.sender_name,
|
|
|
|
});
|
|
|
|
}else{
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(patientcount==2){
|
|
|
|
log.warn("patient system is not in the same session or is not online");
|
|
|
|
}
|
|
|
|
|
|
|
|
//医生外层消息推送
|
|
|
|
let doctorClient = clientCache.findByIdAndType("doctor_system_"+targetUserId,SOCKET_TYPES.DOCTOR_SYSTEM);
|
|
|
|
let pc_doctorClient = clientCache.findByIdAndType("pc_system_"+targetUserId,SOCKET_TYPES.PC_DOCTOR_SYSTEM);
|
|
|
|
if(!doctorClient&&!pc_doctorClient){
|
|
|
|
log.warn("target doctor system is not online!");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var doctorcount = 0;
|
|
|
|
if(doctorClient&&message.session_id==doctorClient.sessionId){
|
|
|
|
WechatClient.updateParticipantLastFetchTime(doctorClient.sessionId, targetUserId, ObjectUtil.timestampToLong(message.timestamp));
|
|
|
|
doctorClient.socket.emit('message', {
|
|
|
|
id: message.id,
|
|
|
|
session_id: message.session_id,
|
|
|
|
sender_id: message.sender_id,
|
|
|
|
sender_name: message.sender_name,
|
|
|
|
content_type: message.content_type,
|
|
|
|
content: message.content,
|
|
|
|
timestamp: ObjectUtil.timestampToLong(message.timestamp),
|
|
|
|
type: message.content_type, // legacy support
|
|
|
|
name: message.sender_name,
|
|
|
|
});
|
|
|
|
}else{
|
|
|
|
doctorcount++;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//发送pc端 - PC端消息不做sessionid的判断,前端自己判断消息归属于哪个会话,自行渲染--20191012-huangwenjie
|
|
|
|
// if(pc_doctorClient&&message.session_id==pc_doctorClient.sessionId){
|
|
|
|
if(pc_doctorClient){
|
|
|
|
WechatClient.updateParticipantLastFetchTime(pc_doctorClient.sessionId, targetUserId, ObjectUtil.timestampToLong(message.timestamp));
|
|
|
|
pc_doctorClient.socket.emit('message', {
|
|
|
|
id: message.id,
|
|
|
|
session_id: message.session_id,
|
|
|
|
sender_id: message.sender_id,
|
|
|
|
sender_name: message.sender_name,
|
|
|
|
content_type: message.content_type,
|
|
|
|
content: message.content,
|
|
|
|
timestamp: ObjectUtil.timestampToLong(message.timestamp),
|
|
|
|
type: message.content_type, // legacy support
|
|
|
|
name: message.sender_name,
|
|
|
|
});
|
|
|
|
}else{
|
|
|
|
doctorcount++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(doctorcount==2){
|
|
|
|
log.warn("doctor system is not in the same session or is not online");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
*
|
|
*
|
|
* 发送微信模板消息给居民
|
|
* 发送微信模板消息给居民
|