军团:更新排行榜信息

This commit is contained in:
luying
2021-12-27 15:37:51 +08:00
parent dbac289d3e
commit 1324447aca
3 changed files with 18 additions and 5 deletions

View File

@@ -78,7 +78,7 @@ export class GmRoleHandler {
let params = new GuildFormParam(msg);
if(!params.checkParams()) return resResult(STATUS.WRONG_PARMS);
let guild = await GuildModel.findByCode(params.code);
let guild = await GuildModel.findByCode(params.code, null, '+members');
let structure = guild.structure||[];
let updateParams: GuildUpdateParam = { code: params.code };
@@ -118,7 +118,12 @@ export class GmRoleHandler {
// 设置玩家名
if(updateParams.name != undefined || updateParams.lv != undefined) {
let arr = [];
if(updateParams.name != undefined) arr.push({ field: 'name', value: updateParams.name });
if(updateParams.name != undefined) {
arr.push({ field: 'name', value: updateParams.name });
for(let roleId of guild.members) {
await updateUserInfo(REDIS_KEY.USER_INFO, roleId, [{ field: 'guildName', value: updateParams.name }]);
}
}
if(updateParams.lv != undefined) arr.push({ field: 'lv', value: updateParams.lv });
await updateUserInfo(REDIS_KEY.GUILD_INFO, params.code, arr);
}

View File

@@ -140,7 +140,7 @@ export class GuildHandler {
if (checkNameResult) return resResult(STATUS.GUILD_NAME_DUP);
}
const select = ['code', 'name', 'notice', 'introduce', 'ceLimit', 'isAuto', 'icon'];
const select = ['code', 'name', 'notice', 'introduce', 'ceLimit', 'isAuto', 'icon', '+members'];
let updateInfo: GuildUpdateParam = {};
if(name != undefined) updateInfo.name = name;
if(notice != undefined) updateInfo.notice = notice;
@@ -152,7 +152,12 @@ export class GuildHandler {
let chatSid = await getGuildChannelSid(code);
this.app.rpc.chat.guildRemote.updateInfo.toServer(chatSid, code, { name, notice, introduce, ceLimit, isAuto });
if(name != undefined) await updateUserInfo(REDIS_KEY.GUILD_INFO, code, [{ field: 'name', value: name }]);
if(name != undefined) {
await updateUserInfo(REDIS_KEY.GUILD_INFO, code, [{ field: 'name', value: name }]);
for(let roleId of guild.members) {
await updateUserInfo(REDIS_KEY.USER_INFO, roleId, [{ field: 'guildName', value: name }]);
}
}
if (notice != undefined) {
pushGuildNoticeUpdateMsg(roleId, roleName, guild);
}

View File

@@ -131,7 +131,7 @@ export async function treatGuildName(content: string) {
return false;
}
let guild = await GuildModel.findByCode(params.code, params.serverId);
let guild = await GuildModel.findByCode(params.code, params.serverId, '+members');
if(guild && guild.sdkMark) { // 有设置标记的情况下
if(params.type == 1) { // 公会名
let newName = "默认公会名";
@@ -143,6 +143,9 @@ export async function treatGuildName(content: string) {
let chatSid = await getGuildChannelSid(params.code);
pinus.app.rpc.chat.guildRemote.updateInfo.toServer(chatSid, params.code, { name: newName }); // 军团推送
await updateUserInfo(REDIS_KEY.GUILD_INFO, params.code, [{ field: 'name', value: newName }]); // redis缓存信息
for(let roleId of guild.members) {
await updateUserInfo(REDIS_KEY.USER_INFO, roleId, [{ field: 'guildName', value: newName }]);
}
await RoleModel.updateGuildName(params.code, newName);
} else if (params.type == 2) { // 公会公告