初始:创建账号时检查重名
This commit is contained in:
@@ -28,36 +28,6 @@ export class RoleHandler {
|
|||||||
constructor(private app: Application) {
|
constructor(private app: Application) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async initEquips(roleId: string, roleName: string) {
|
|
||||||
// const seqId = await CounterModel.getNewCounter(COUNTER.EID);
|
|
||||||
// const equipInfo = {
|
|
||||||
// roleId,
|
|
||||||
// roleName,
|
|
||||||
// id: 1,
|
|
||||||
// name: '倚天剑',
|
|
||||||
// seqId,
|
|
||||||
// type: 1
|
|
||||||
// }
|
|
||||||
// const equip = await EquipModel.createEquip(equipInfo);
|
|
||||||
// await HeroModel.addEquip(roleId, 12, 1, equip._id);
|
|
||||||
}
|
|
||||||
|
|
||||||
async initHeros(roleId: string, roleName: string) {
|
|
||||||
|
|
||||||
const heroInfo = {
|
|
||||||
roleId,
|
|
||||||
roleName,
|
|
||||||
hid: 1,
|
|
||||||
hName: '曹操',
|
|
||||||
quality: 1,
|
|
||||||
job: 1,
|
|
||||||
star: 0,
|
|
||||||
serverId: 1,
|
|
||||||
skins: [{ id: 41001, enable: true }]
|
|
||||||
}
|
|
||||||
await HeroModel.createHero(heroInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
async initRole(msg: { roleName: string }, session: BackendSession) {
|
async initRole(msg: { roleName: string }, session: BackendSession) {
|
||||||
|
|
||||||
let roleId = session.get('roleId');
|
let roleId = session.get('roleId');
|
||||||
@@ -69,6 +39,9 @@ export class RoleHandler {
|
|||||||
let role = await RoleModel.findByRoleId(roleId, 'roleName hasInit');
|
let role = await RoleModel.findByRoleId(roleId, 'roleName hasInit');
|
||||||
if(role.hasInit) return resResult(STATUS.ROLE_HAS_INIT);
|
if(role.hasInit) return resResult(STATUS.ROLE_HAS_INIT);
|
||||||
|
|
||||||
|
let checkName = await RoleModel.checkName(roleName, serverId);
|
||||||
|
if (checkName) return resResult(STATUS.NAME_HAS_USED);
|
||||||
|
|
||||||
let heroInfos = [];
|
let heroInfos = [];
|
||||||
for (let hid of DEFAULT_HEROES) {
|
for (let hid of DEFAULT_HEROES) {
|
||||||
heroInfos.push({
|
heroInfos.push({
|
||||||
|
|||||||
Reference in New Issue
Block a user