Explorar o código

Merge branch 'im-internet-hospital' of http://192.168.1.220:10080/Amoy/im.doctor into im-internet-hospital

bing %!s(int64=3) %!d(string=hai) anos
pai
achega
378bc7d8f2

+ 1 - 1
src/server/app.js

@ -128,7 +128,7 @@ if(!server.address()){
    log.info('Configuration profile: ' + configFile.split('.')[1]);
}
JobInitializer.init();
// JobInitializer.init();
pubSub.registerHandlers(config.subChannel,msg=> console.log(msg));
pubSub.subscribe(config.subChannel);

+ 5 - 5
src/server/handlers/socket.handler.js

@ -7,7 +7,7 @@
let log = require("../util/log.js");
let clientCache = require('../models/socket.io/client.cache').clientCache();
let onlineCache = require('../models/socket.io/onlineCache').onlineCache();
// let onlineCache = require('../models/socket.io/onlineCache').onlineCache();
let PatientClient = require('./../models/socket.io/patient.client');
let PcPatientClient = require('./../models/socket.io/pcPatient.client');
let PcDoctorClient  = require('./../models/socket.io/pcDoctor.client');
@ -107,7 +107,7 @@ class SocketHandler {
                            patientClient.sessionId = data.sessionId||"";
                            patientClient.userType = data.userType||"";
                            clientCache.addClient(patientClient);
                            onlineCache.addUser(data.userId,patientClient.userType);
                            // onlineCache.addUser(data.userId,patientClient.userType);
                            users.login(data.userId, 10, '', '');
                            //修改居民在线状态
                            let participants = new Participants();
@ -152,7 +152,7 @@ class SocketHandler {
                            doctorClient.sessionId =  data.sessionId||"";
                            doctorClient.userType = data.userType||"";
                            clientCache.addClient(doctorClient);
                            onlineCache.addUser(data.userId,doctorClient.userType);
                            // onlineCache.addUser(data.userId,doctorClient.userType);
                            //修改医生在线状态
                            let participants = new Participants();
                            //participants.changUserRedisLoginStatus(original_login_userid,data.clientType,1,doctorClient.sessionId);
@ -358,7 +358,7 @@ class SocketHandler {
                        participants.emitSessionUsers(client.sessionId,client.userId,"offline");
                    }
                    log.info('User logout: ' + client.userId);
                    onlineCache.removeUser(client.userId,client.userType);
                    // onlineCache.removeUser(client.userId,client.userType);
                    clientCache.removeByUserId(client.userId);
                }
@ -401,7 +401,7 @@ class SocketHandler {
                        participants.emitSessionUsers(patientClient.sessionId,patientClient.userId,"offline");
                    }*/
                    log.info("User disconnect: ", patientClient.userId);
                    onlineCache.removeUser(patientClient.userId,patientClient.userType);
                    // onlineCache.removeUser(patientClient.userId,patientClient.userType);
                    clientCache.removeByUserSocket(socket);
                }
            });

+ 1 - 1
src/server/models/schedule/job.initializer.js

@ -10,7 +10,7 @@ class JobInitializer {
    // schedule jobs
    static init() {
        Scheduler.cronSchedule("0 0 3 * * *", TopicTerminatingJob.exec);
        // Scheduler.cronSchedule("0 0 3 * * *", TopicTerminatingJob.exec);
    }
}

+ 2 - 2
src/server/models/socket.io/onlineCache.js

@ -82,7 +82,7 @@ class OnlineCache{
    //新增用户,判断用户是否在线,在线人数统计
    addUser(userId,type) {
        userId = this.repalceUserId(userId);
        this.updatePatientStatus(userId,type,1);
        // this.updatePatientStatus(userId,type,1);
        let key = userId+":"+type;
        let count = this.findByIdAndType(userId,type);
        if(count&&count>0){
@ -182,7 +182,7 @@ class OnlineCache{
            return;
        }
        userId = this.repalceUserId(userId);
        this.updatePatientStatus(userId,type,0);
        // this.updatePatientStatus(userId,type,0);
        let key = userId+":"+type;
        let count = this.findByIdAndType(userId,type);
        if(count&&count>1){