✨ feat(gvg): 组建期聊天和邮件
This commit is contained in:
@@ -19,6 +19,8 @@ export async function createNewGVGConfig() {
|
||||
setGVGConfigToRemote(config);
|
||||
// TODO 每周自动解散一些联军
|
||||
await pinus.app.rpc.guild.guildRemote.setGVGServerGroup.broadcast();
|
||||
await pinus.app.rpc.chat.chatRemote.setGVGServerGroup.broadcast();
|
||||
await pinus.app.rpc.connector.connectorRemote.setGVGServerGroup.broadcast();
|
||||
return config;
|
||||
}
|
||||
|
||||
@@ -157,12 +159,16 @@ export async function getServersOfSameGroup(type: GVG_SERVER_TYPE, id: number) {
|
||||
if(type == GVG_SERVER_TYPE.SINGLE) return [id];
|
||||
|
||||
let groupId = await getGroupIdOfServer(id);
|
||||
return await getServersByGroupId(groupId);
|
||||
}
|
||||
|
||||
export async function getServersByGroupId(groupId: number) {
|
||||
let arr: { serverId: number; groupId: number }[] = pinus.app.get('gvgServerGroup')||[];
|
||||
let serverCreateTimes = await getAllServerCreateTime();
|
||||
|
||||
return arr.filter(obj => {
|
||||
let openTime = parseInt(serverCreateTimes[obj.serverId]);
|
||||
return obj.groupId == groupId && getServerTypeByTime(openTime) == type;
|
||||
return obj.groupId == groupId && getServerTypeByTime(openTime) == GVG_SERVER_TYPE.MULTI;
|
||||
}).map(obj => obj.serverId);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user