聊天:玩家在军团频道发消息的测试

This commit is contained in:
liangtongchuan
2021-03-09 12:48:06 +08:00
parent 2e17c873e2
commit 01e8dca8c9
3 changed files with 11 additions and 6 deletions
@@ -115,6 +115,7 @@ export class EntryHandler {
if(guild) { if(guild) {
addRoleToGuildChannel(role.roleId, self.app.get('serverId'), userGuild.guildCode); addRoleToGuildChannel(role.roleId, self.app.get('serverId'), userGuild.guildCode);
role['guildAuth'] = userGuild.auth; role['guildAuth'] = userGuild.auth;
role['guildCode'] = userGuild.guildCode;
let {lv: guildLv, memberCnt} = guild; let {lv: guildLv, memberCnt} = guild;
let dicGuild = gameData.centerBase.get(guildLv); let dicGuild = gameData.centerBase.get(guildLv);
if(dicGuild && memberCnt >= dicGuild.peopleNum) { if(dicGuild && memberCnt >= dicGuild.peopleNum) {
+6 -6
View File
@@ -151,17 +151,17 @@ async function addRoleToChannel(roomId: string, roleId: string, sid: string) {
} }
export async function addRoleToSysChannel(roleId: string, sid: string, serverId: number) { export async function addRoleToSysChannel(roleId: string, sid: string, serverId: number) {
const roomId = groupRoomId('sys', `${serverId}`); const roomId = groupRoomId(CHANNEL_PREFIX.SYS, `${serverId}`);
await addRoleToChannel(roomId, roleId, sid); await addRoleToChannel(roomId, roleId, sid);
} }
export async function addRoleToWorldChannel(roleId: string, sid: string, serverId: number) { export async function addRoleToWorldChannel(roleId: string, sid: string, serverId: number) {
const roomId = groupRoomId('new_world', `${serverId}`); const roomId = groupRoomId(CHANNEL_PREFIX.WORLD, `${serverId}`);
await addRoleToChannel(roomId, roleId, sid); await addRoleToChannel(roomId, roleId, sid);
} }
export async function addRoleToGuildChannel(roleId: string, sid: string, guildCode: string) { export async function addRoleToGuildChannel(roleId: string, sid: string, guildCode: string) {
const roomId = groupRoomId('new_guild', guildCode); const roomId = groupRoomId(CHANNEL_PREFIX.GUILD, guildCode);
await addRoleToChannel(roomId, roleId, sid); await addRoleToChannel(roomId, roleId, sid);
} }
@@ -171,19 +171,19 @@ async function leaveChannel(roomId: string, roleId: string, sid: string) {
} }
export async function leaveSysChannel(roleId: string, sid: string, serverId: number) { export async function leaveSysChannel(roleId: string, sid: string, serverId: number) {
const roomId = groupRoomId('sys', `${serverId}`); const roomId = groupRoomId(CHANNEL_PREFIX.SYS, `${serverId}`);
await leaveChannel(roomId, roleId, sid); await leaveChannel(roomId, roleId, sid);
} }
export async function leaveWorldChannel(roleId: string, sid: string, serverId: number) { export async function leaveWorldChannel(roleId: string, sid: string, serverId: number) {
const roomId = groupRoomId('new_world', `${serverId}`); const roomId = groupRoomId(CHANNEL_PREFIX.WORLD, `${serverId}`);
await leaveChannel(roomId, roleId, sid); await leaveChannel(roomId, roleId, sid);
} }
export async function leaveGuildChannel(roleId: string, sid: string) { export async function leaveGuildChannel(roleId: string, sid: string) {
const { guildCode } = await RoleModel.findByRoleId(roleId, 'guildCode'); const { guildCode } = await RoleModel.findByRoleId(roleId, 'guildCode');
if (!guildCode) return; if (!guildCode) return;
const roomId = groupRoomId('new_guild', guildCode); const roomId = groupRoomId(CHANNEL_PREFIX.GUILD, guildCode);
await leaveChannel(roomId, roleId, sid); await leaveChannel(roomId, roleId, sid);
} }
+4
View File
@@ -266,4 +266,8 @@ describe('聊天测试', function() {
it('测试世界频道消息', function(done) { it('测试世界频道消息', function(done) {
testGroupMsg(pinusClient, roleInfo, pinusClientT, CHANNEL_PREFIX.WORLD, roleInfo.serverId, done); testGroupMsg(pinusClient, roleInfo, pinusClientT, CHANNEL_PREFIX.WORLD, roleInfo.serverId, done);
}); });
it('测试军团频道消息', function(done) {
testGroupMsg(pinusClient, roleInfo, pinusClientT, CHANNEL_PREFIX.GUILD, roleInfo.guildCode, done);
});
}); });