瀏覽代碼

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

# Conflicts:
#	src/server/models/client/wechat.client.js
wangzhinan 5 年之前
父節點
當前提交
1da0c2a5e3
共有 2 個文件被更改,包括 6 次插入6 次删除
  1. 2 1
      src/server/models/sessions/sessions.js
  2. 4 5
      src/server/repository/mysql/session.repo.js

+ 2 - 1
src/server/models/sessions/sessions.js

@ -1514,7 +1514,7 @@ class Sessions extends RedisModel {
                         continue;
                     }
                 }*/
                logger.info("type==="+res[j].type);
                if (res[j].type == SESSION_TYPES.SYSTEM) {
                    if (j == res.length - 1) {
@ -1607,6 +1607,7 @@ class Sessions extends RedisModel {
    getSessionUnreadMessageCount(sessionId, userId, handler) {
        let self = this;
        let messagesByTimestampKey = RedisModel.makeRedisKey(REDIS_KEYS.MessagesByTimestamp, sessionId);
        logger.info("============"+messagesByTimestampKey)
        let participantsKey = RedisModel.makeRedisKey(REDIS_KEYS.SessionParticipants, sessionId);
        async.waterfall([
            // 此成员最后获取消息的时间

+ 4 - 5
src/server/repository/mysql/session.repo.js

@ -58,8 +58,8 @@ class SessionRepo {
     * @param handler
     */
    static findUnEndAll(userId, handler) {
        let sql = "select session_id from " + DB_TABLES.Participants + " w where w.participant_id = ? and participant_role =0  group by w.session_id";
        let sys_session = "select session_id from " + DB_TABLES.Participants + " w where w.participant_id = 'system' and participant_role =0  group by w.session_id";
        let sql = "select session_id from " + DB_TABLES.Participants + " w where w.participant_id = ? and participant_role in(0,1)  group by w.session_id";
        let sys_session = "select session_id from " + DB_TABLES.Participants + " w where w.participant_id = 'system' and participant_role in(0,1)  group by w.session_id";
        let sessionSQL = "select id, name, type, create_date,business_type, last_sender_id, last_sender_name, last_content_type, last_content, last_message_time,status from "
            + DB_TABLES.Sessions + " s where s.id in(" + sql + ") and s.id not in ("+sys_session+") and s.`status` = 0";
        ImDb.execQuery({
@ -124,12 +124,11 @@ class SessionRepo {
    static findAllByTypes(userId, type, handler) {
        let sql = "select session_id from " + DB_TABLES.Participants + " w where w.participant_id = ?  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 type in(?) AND S.STATUS = 0 ";
            + DB_TABLES.Sessions + " s where s.id in(" + sql + ") and type in("+type+") AND S.STATUS = 0 ";
        log.info("获取用户全部会话: sql :" + sessionSQL);
        log.info("userId"+userId+"=========type"+type);
        ImDb.execQuery({
            "sql": sessionSQL,
            "args": [userId, type],
            "args": [userId],
            "handler": handler || function (err, res) {
                if(err) log.error(err);
            }