Browse Source

成员变化的时候时间更新为空问题处理

8 years ago
parent
commit
546ef9ad97
1 changed files with 13 additions and 3 deletions
  1. 13 3
      src/server/models/sessions/sessions.js

+ 13 - 3
src/server/models/sessions/sessions.js

@ -353,7 +353,7 @@ class Sessions extends RedisModel {
                            .zscore(sessionParticipantsKey, userId)    // 用户在此会话中最后一次获取未读消息的时间
                            .zrange(sessionParticipantsKey, 0, -1)
                            .zrange(sessionParticipantsKey, 0,-1,'withscores')  // 所有用户在此会话中最后一次获取未读消息的时间
                            .hgetall(participantsRoleKey)  // 所有用户在此会话中最后一次获取未读消息的时间
                            .hgetall(participantsRoleKey)  // 所有用户在此会话中角色
                            .execAsync()
                            .then(function (res) {
                                let session = res[0];
@ -494,6 +494,7 @@ class Sessions extends RedisModel {
                            .zscore(sessionParticipantsKey, userId)    // 用户在此会话中最后一次获取未读消息的时间
                            .zrange(sessionParticipantsKey, 0, -1)
                            .zrange(sessionParticipantsKey, 0,-1,'withscores')  // 所有用户在此会话中最后一次获取未读消息的时间
                            .hgetall(participantsRoleKey)  // 所有用户在此会话中角色
                            .execAsync()
                            .then(function (res) {
                                let session = res[0];
@ -501,7 +502,15 @@ class Sessions extends RedisModel {
                                let lastFetchTime = res[2];
                                let users = res[3];
                                let participantsTimeArray = res[4];
                                let userRoles = res[5];
                                let participantsTime = [];
                                let isInvite = true;
                                for(var j in userRoles){
                                    if(userRoles[j]==1){
                                        isInvite = false;
                                        break;
                                    }
                                }
                                for(var j = 0 ;j<participantsTimeArray.length;j++){
                                    if(j%2!=0)continue;
                                    let participantsTimeJson = {};
@ -556,7 +565,8 @@ class Sessions extends RedisModel {
                                                sender_sex: sex,
                                                sender_birthday: bir,
                                                participantsTimeArray:participantsTime,
                                                status:session.status
                                                status:session.status,
                                                is_invite:isInvite
                                            });
                                            index = (parseInt(index) + 1);
@ -1029,7 +1039,7 @@ class Sessions extends RedisModel {
                                                            message.content_type == CONTENT_TYPES.Audio||
                                                            message.content_type == CONTENT_TYPES.Video)){
                            TopicRepo.findLastBySessionId(sessionId,function(err,res){
                                if(res&&res.length>0){
                                if(res&&res.length>0&&res[0].reply==0){
                                    TopicRepo.updateTopics(res[0].id,{reply:1},function(err,res){
                                        if(err){
                                            logger.error("update topic reply error");