系统:修改玩家名

This commit is contained in:
luying
2021-03-11 19:43:36 +08:00
parent ee9f443f7a
commit 0eb016567b
2 changed files with 15 additions and 0 deletions

View File

@@ -494,4 +494,18 @@ export class RoleHandler {
return resResult(STATUS.SUCCESS, { spines: role.spines, spine: role.spine });
}
// 改名
async rename(msg: { roleName: string }, session: BackendSession) {
let { roleName } = msg;
let roleId = session.get('roleId');
// TODO 可能需要,检查是否重名
// let checkName = await RoleModel.findRoleByField('roleName', [roleName]);
// if(checkName.length > 0) return resResult(STATUS.NAME_HAS_USED);
let role = await RoleModel.updateRoleInfo(roleId, { roleName });
return resResult(STATUS.SUCCESS, { roleName: role.roleName });
}
}

View File

@@ -23,6 +23,7 @@ export const STATUS = {
ACCOUNT_NOT_GUEST: { code: 10012, simStr: '该账号已绑定过' },
AUTHEN_FAIL: { code: 10013, simStr: '实名失败' },
TEL_LEN_ERR: { code: 10014, simStr: '手机长度错误' },
NAME_HAS_USED: { code: 10015, simStr: '该名字已使用' },
// 战斗相关状态 20000 - 29999
// 战斗通用 20000 - 20099
BATTLE_MISS_INFO: { code: 20001, simStr: '缺少关卡信息' },