Pārlūkot izejas kodu

医养调度分析

Shi Kejing 3 gadi atpakaļ
vecāks
revīzija
027b864213

+ 7 - 3
src/server/endpoints/v2/session.endpoint.js

@ -245,9 +245,13 @@ router.get(APIv2.Sessions.SessionListByType, function (req, res) {
    if (!type) {
        throw {httpStatus: 406, message: 'Missing type.'};
    }
    if (!userId) {
        throw {httpStatus: 406, message: 'Missing user.'};
    }
    /**
     * userId 为传值时:管理员调度大屏获取im消息
     */
    // if (!userId) {
    //     throw {httpStatus: 406, message: 'Missing user.'};
    // }
    let sessions = new Sessions();
    ControllerUtil.regModelEventHandler(sessions, res);

+ 8 - 0
src/server/models/sessions/sessions.js

@ -966,6 +966,14 @@ class Sessions extends RedisModel {
                        let sessionId = mysqlSession.id;
                        let sessionKey = RedisModel.makeRedisKey(REDIS_KEYS.Session, sessionId);
                        let sessionParticipantsKey = RedisModel.makeRedisKey(REDIS_KEYS.SessionParticipants, sessionId);
                        /**
                         * userId 为传值时:管理员调度大屏获取im消息
                         */
                        if (userId == null || userId == "") {
                            userId = sessionId.substring(0,sessionId.indexOf('_'));
                        }
                        redis.multi()
                            .hgetall(sessionKey)                       // 会话实体
                            .zscore(sessionParticipantsKey, userId)    // 用户在此会话中最后一次获取未读消息的时间

+ 9 - 1
src/server/repository/mysql/session.repo.js

@ -176,7 +176,15 @@ class SessionRepo {
            }
        }
        let sql = "select session_id from " + DB_TABLES.Participants + " w where w.participant_id in(?) group by w.session_id";
        let sql = "";
        /**
         * userId 为传值时:管理员调度大屏获取im消息
         */
        if (userId != null && userId != "") {
            sql = "select session_id from " + DB_TABLES.Participants + " w where w.participant_id in(?) group by w.session_id";
        } else {
            sql = "select session_id from " + DB_TABLES.Participants + " w group by w.session_id"
        }
        let sessionSQL = "select id, name, type, create_date, last_sender_id, last_sender_name, last_content_type, last_content, last_message_time from "
            + DB_TABLES.Sessions + " s where s.id in(" + sql + ") and s.type in("+type+") ";