账号:创建账号前的检查

This commit is contained in:
liangtongchuan
2021-09-10 20:54:45 +08:00
parent 14f7b3dd9c
commit 635d725932
2 changed files with 5 additions and 0 deletions

View File

@@ -299,6 +299,10 @@ export default class Auth extends Service {
console.log('enter Auth createRole');
const ctx = this.ctx;
const { uid } = ctx;
const exist = await RoleModel.exists({ 'userInfo.uid': uid, serverId });
if (exist === true) {
return ctx.service.utils.resResult(STATUS.ROLE_EXIST);
}
const roleId = ctx.service.utils.genCode(10);
const code = ctx.service.utils.genCode(6);
const seqId = await Counter.getNewCounter(COUNTER.ROLE) || -1;