浏览代码

获取会话列表新增返回成员时间

8 年之前
父节点
当前提交
91121998e9
共有 2 个文件被更改,包括 11 次插入1 次删除
  1. 10 0
      src/server/models/sessions/sessions.js
  2. 1 1
      src/server/repository/redis/redis.client.js

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

@ -354,12 +354,21 @@ class Sessions extends RedisModel {
                            .hget(participantsRoleKey, userId)         // 用户在此会话中的角色
                            .zscore(sessionParticipantsKey, userId)    // 用户在此会话中最后一次获取未读消息的时间
                            .zrange(participantsKey, 0, -1)
                            .zrange(sessionParticipantsKey, 0,-1,'withscores')  // 所有用户在此会话中最后一次获取未读消息的时间
                            .execAsync()
                            .then(function (res) {
                                let session = res[0];
                                let role = res[1];
                                let lastFetchTime = res[2];
                                let users = res[3];
                                let participantsTimeArray = res[4];
                                let participantsTime = [];
                                for(var j = 0 ;j<participantsTimeArray.length;j++){
                                    if(j%2!=0)continue;
                                    let participantsTimeJson = {};
                                    participantsTimeJson[participantsTimeArray[j]] = participantsTimeArray[j+1];
                                    participantsTime.push(participantsTimeJson);
                                }
                                let sessionName = "";
                                let otherUserId = "";
                                if (session.type == SESSION_TYPES.P2P) {
@ -408,6 +417,7 @@ class Sessions extends RedisModel {
                                                my_role: role,
                                                sender_sex: sex,
                                                sender_birthday: bir,
                                                participantsTimeArray:participantsTime
                                            });
                                            index = (parseInt(index) + 1);

+ 1 - 1
src/server/repository/redis/redis.client.js

@ -27,7 +27,7 @@ class RedisClient {
            config.redisConfig
        );
        this._connection.auth(config.redisConfig.password,function(){
        this._connection.auth(config.redisConfig.password||"",function(){
            console.log('通过认证');
        });