Browse Source

Merge branch 'feature-refactor' of http://192.168.1.220:10080/Amoy/im.doctor into feature-refactor

Sand 8 years ago
parent
commit
d2701cbda4

+ 1 - 0
src/server/include/commons.js

@ -98,6 +98,7 @@ exports.REDIS_KEYS = {
    Session: "sessions:" + REDIS_KEY_REPLACER,
    Participants: "participants:" + REDIS_KEY_REPLACER,
    ParticipantsRole:"participants:" + REDIS_KEY_REPLACER+":role",
    Topics: "sessions:" + REDIS_KEY_REPLACER + ":topics",
    Topic: "topics:" + REDIS_KEY_REPLACER,

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

@ -142,12 +142,25 @@ class Sessions extends RedisModel {
                redis.zrangebyscoreAsync(message_time_key, restimestamp, (new Date().getTime())).then(function (messagetimelist) {
                    res.sessionId = session;
                    res.message = messagetimelist.length;
                    callback(res, j, _len);
                    callrole(res, j, _len,session);
                }).catch(function (err) {
                    throw err;
                })
            }
            /**
             * 用户角色
             * @param res要返回的JSON
             * @param j 第N调数据
             * @param _len 总数据长度
             */
            function callrole(res, j, _len,session){
                let participants_role_key = _super(RedisKeys.ParticipantsRole, session);
                redis.hgetAsync(participants_role_key, userId).then(function(role){
                    res.role=role;
                    callback(res, j, _len);
                })
            }
            /**
             * 列表封装完毕后由此回调返回数据界面
             * @param res

+ 1 - 1
src/server/repository/mysql/participant.repo.js

@ -88,7 +88,7 @@ class ParticipantRepo {
     *
     * @param userIds
     */
    saveParticipantsToMysql(session_id, userIds) {
    static saveParticipantsToMysql(session_id, userIds) {
        let sql = "insert into " + DB_TABLES.Participants + " (session_id,participant_id,participant_role,receiving) VALUES "
        let args = [];
        for (var j in userIds) {