diff --git a/game-server/app/servers/guild/handler/guildHandler.ts b/game-server/app/servers/guild/handler/guildHandler.ts index 1ac60805c..6aa789977 100644 --- a/game-server/app/servers/guild/handler/guildHandler.ts +++ b/game-server/app/servers/guild/handler/guildHandler.ts @@ -3,7 +3,7 @@ import { resResult, getRandEelm, shouldRefresh, sortArrRandom } from '../../../p import { STATUS, GUILD_OPERATE, GUILD_AUTH, GUILD_JOB, GUILD_APPLY_TYPE, GUILD_STRUCTURE, GUILD_REC_TYPE, GUILD_STRUCTURE_NAME, MAIL_TYPE, REDIS_KEY, GUILD_SELECT, USER_GUILD_SELECT, TASK_TYPE, DEBUG_MAGIC_WORD } from '../../../consts'; import { UserGuildModel, UserGuildType } from '../../../db/UserGuild'; import { checkAuth, joinGuild, getGuildWithRefActive, getUserGuildWithRefActive, addActive, settleGuildWeekly, getMyGuildInfo, refreshUserGuild, setUserGuildSession } from '../../../services/guildService'; -import { GuildModel, GuildType } from '../../../db/Guild'; +import { GuildModel, GuildType, GuildUpdateParam } from '../../../db/Guild'; import { RoleModel, RoleType } from '../../../db/Role'; import { ARMY } from '../../../pubUtils/dicParam'; import { handleCost, addItems } from '../../../services/rewardService'; @@ -117,20 +117,27 @@ export class GuildHandler { } // 团长修改军团名等信息 - async setGuildInfo(msg: guildInter & { code: string, name: string, notice: string, introduce: string, ceLimit: number, isAuto: boolean }, session: BackendSession) { + async setGuildInfo(msg: guildInter & { code: string, name: string, notice: string, introduce: string, ceLimit: number, isAuto: boolean, icon: number }, session: BackendSession) { const roleId = session.get('roleId'); const roleName = session.get('roleName'); - const { code, name, notice, introduce, ceLimit, isAuto } = msg; - if (!name) return resResult(STATUS.WRONG_PARMS); + const { code, name, notice, introduce, ceLimit, isAuto, icon } = msg; + if (!code) return resResult(STATUS.WRONG_PARMS); const select = ['code', 'name', 'notice', 'introduce', 'ceLimit', 'isAuto', 'icon']; - const guild = await GuildModel.updateInfo(code, { name, notice, introduce, ceLimit, isAuto }, {}, select.join(' ')); + let updateInfo: GuildUpdateParam = {}; + if(name != undefined) updateInfo.name = name; + if(notice != undefined) updateInfo.notice = notice; + if(introduce != undefined) updateInfo.introduce = introduce; + if(ceLimit != undefined) updateInfo.ceLimit = ceLimit; + if(isAuto != undefined) updateInfo.isAuto = isAuto; + if(icon != undefined) updateInfo.icon = icon; + const guild = await GuildModel.updateInfo(code, updateInfo, {}, select.join(' ')); let chatSid = await getGuildChannelSid(code); this.app.rpc.chat.guildRemote.updateInfo.toServer(chatSid, code, { name, notice, introduce, ceLimit, isAuto }); - await updateUserInfo(REDIS_KEY.GUILD_INFO, code, [{ field: 'name', value: name }]); - if (notice) { + if(name != undefined) await updateUserInfo(REDIS_KEY.GUILD_INFO, code, [{ field: 'name', value: name }]); + if (notice != undefined) { pushGuildNoticeUpdateMsg(roleId, roleName, guild); } // 返回