Browse Source

居民外层消息推送

huangwenjie 5 years ago
parent
commit
1b8024e546
1 changed files with 9 additions and 2 deletions
  1. 9 2
      src/server/models/client/wechat.client.js

+ 9 - 2
src/server/models/client/wechat.client.js

@ -73,8 +73,11 @@ class WechatClient extends RedisModel {
            let pc_patientClient = clientCache.findById("pcpatient_"+targetUserId);
            let pc_patientClient = clientCache.findById("pcpatient_"+targetUserId);
            let doctorClient = clientCache.findByIdAndType(message.sender_id,SOCKET_TYPES.DOCTOR);
            let doctorClient = clientCache.findByIdAndType(message.sender_id,SOCKET_TYPES.DOCTOR);
            let pc_doctorClient = clientCache.findByIdAndType("pc_"+message.sender_id,SOCKET_TYPES.PC_DOCTOR);
            let pc_doctorClient = clientCache.findByIdAndType("pc_"+message.sender_id,SOCKET_TYPES.PC_DOCTOR);
            let pc_patient_system_Client = clientCache.findByIdAndType("pcpatient_system_"+targetUserId,SOCKET_TYPES.PC_PATIENT_SYSTEM);
            var count = 0;
            var count = 0;
            if (patientClient || pc_patientClient) {
            if (patientClient || pc_patientClient || pc_patient_system_Client) {
                if(patientClient){
                if(patientClient){
                    log.warn("User's wechat endpoint is online, sending via web socket. User id: ", targetUserId);
                    log.warn("User's wechat endpoint is online, sending via web socket. User id: ", targetUserId);
@ -86,8 +89,12 @@ class WechatClient extends RedisModel {
                    WechatClient.sendViaWebSocket(pc_patientClient.socket, message);
                    WechatClient.sendViaWebSocket(pc_patientClient.socket, message);
                }
                }
                if(pc_patient_system_Client){
                    log.warn("User's pc systme endpoint is online, sending via web socket. User id: ", targetUserId);
                    WechatClient.sendViaWebSocket(pc_patient_system_Client.socket, message);
                }
                if(doctorClient){
                if(doctorClient && (patientClient || pc_patientClient) ){
                    log.error("doctor sessionid "+doctorClient.sessionId);
                    log.error("doctor sessionid "+doctorClient.sessionId);
                    if(patientClient && patientClient.sessionId==doctorClient.sessionId){
                    if(patientClient && patientClient.sessionId==doctorClient.sessionId){