Browse Source

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

Conflicts:
	src/server/models/sessions/sessions.js
8 năm trước cách đây
mục cha
commit
b0c3c93d41

+ 5 - 5
src/server/endpoints/v2/session.endpoint.js

@ -157,19 +157,19 @@ router.get(APIv2.Sessions.ParticipantsAvatar, function (req, res) {
 * sessionId 会话ID
 */
router.put(APIv2.Sessions.Participant, function (req, res) {
    let user = req.query.user;
    let user = req.params.participant_id;
    if (!user) {
        throw {httpStatus: 406, message: 'Missing user.'};
        throw {httpStatus: 406, message: 'Missing participant_id.'};
    }
    let sessionId = req.query.sessionId;
    let sessionId = req.params.session_id;
    if (!sessionId) {
        throw {httpStatus: 406, message: 'Missing sessionId.'};
        throw {httpStatus: 406, message: 'Missing session_id.'};
    }
    let participants = new Participants();
    ControllerUtil.regModelEventHandler(sessions, res);
    ControllerUtil.regModelEventHandler(participants, res);
    participants.addUser(sessionId, user);
});

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

@ -190,10 +190,10 @@ class Participants extends RedisModel {
     */
    addUser(sessionId, user) {
        let self = this;
        let users = [user];
        self.saveParticipantsToRedis(sessionId, users, new Date(), function (res) {
        let users = [user+":"+0];
        Participants.saveParticipantsToRedis(sessionId, users, new Date(), function (res) {
            if (res) {
                self.saveParticipantsToMysql(sessionId, users);
                Participants.saveParticipantsToMysql(sessionId, users);
            } else {
                ModelUtil.emitOK(self.eventEmitter, {message: "成员添加失败"});
            }