private chat ok

This commit is contained in:
lightings 2023-05-17 16:18:37 +08:00
parent b7cd139ed1
commit 3dbd8ca66a
3 changed files with 12 additions and 4 deletions

View File

@ -361,8 +361,6 @@ class ChatHandler {
const contentType = msg.contentType;
const targetuid = msg.targetuid;
const channelId = `privateChannel_${targetuid}`;
this.gcs.add(channelId, session.uid, session.get("sid"), function () {});
this.gcs.pushMessage(
"connector",
"onChat",

View File

@ -27,7 +27,7 @@ class ChatRemote {
const teamChannelId = `teamChannel_${teamId}`
this.gcs.leave(teamChannelId, uid, sid);
}
this.chatService.kick(uid, cb);
cb();
}

View File

@ -13,6 +13,7 @@ var Handler = function (app) {
this.gameapiUrl = this.app.get("gameapi").gameBaseURL;
this.valid_entry_login = axios.create({baseURL:this.gameapiUrl});
this.channelService = this.app.get("channelService");
this.gcs = this.app.get("globalChannelService");
};
/** @api {post} connector.entryHandler.entry entry --
@ -81,6 +82,10 @@ Handler.prototype.entry = function (msg, session, next) {
next(null, { code: 500, error: true });
return;
}
const channelId = `privateChannel_${uid}`;
this.gcs.add(channelId, session.uid, session.get("sid"), function () {});
next(null, { code: 200, msg: "game server is ok." });
});
});
@ -103,10 +108,15 @@ var onUserLeave = function (app, session, reason) {
if (!session || !session.uid) {
return;
}
logger.debug(`onUserLeave ${session.id} : ${session.uid}`);
const uid = session.uid;
const sid = session.get("sid");
const privateChannelId = `privateChannel_${uid}`;
this.gcs.leave(privateChannelId, uid, sid);
const teamid = session.get("teamid");
app.rpc.chat.chatRemote.kick(session, session.uid, session.get('sid'), teamid, null);
app.rpc.chat.chatRemote.kick(session, uid, sid, teamid, null);
};