后台:修改权限用表

This commit is contained in:
luying
2022-01-04 11:19:08 +08:00
parent 70068402a1
commit c32744f276
13 changed files with 67 additions and 133 deletions
-2
View File
@@ -63,10 +63,8 @@ app.set('name', 'zyz');
// 全局配置,对所有 env 所有 serverType 生效
app.configure(function () {
app.loadConfig('database', app.getBase() + '/config/database');
app.loadConfig('serverName', app.getBase() + '/config/serverName');
console.log('env:', app.get('env'));
console.log('db:', app.get('database'));
console.log('serverName:', app.get('serverName'))
initMongodb(app);
initGmMongodb(app);
@@ -245,18 +245,23 @@ export class EntryHandler {
console.log('user token not found');
return resResult(STATUS.TOKEN_ERR);
}
if(!user.isEnable) {
return resResult(STATUS.GM_NO_AUTHORITY_GET);
}
// console.log(self.app.get('serverId'));
await session.abind(user.username);
session.set('uid', user.uid);
session.set('roleId', user.username);
session.set('roleName', user.name);
session.set('groupId', user.groupId);
session.set('eventStatus', 0);
session.set('sid', self.app.get('serverId'));
session.push('uid', () => { });
session.push('sid', () => { });
session.push('roleId', () => { });
session.push('roleName', () => { });
session.push('groupId', () => { });
session.push('eventStatus', () => { });
// session.push('rid', function (err) {
// if (err) {
@@ -267,7 +272,6 @@ export class EntryHandler {
// put user into channel
return resResult(STATUS.SUCCESS, {
serverType: this.app.get('serverName'),
env: this.app.get('env')
});
}
@@ -2,7 +2,6 @@ import {Application, RouteRecord, FrontendOrBackendSession, HandlerCallback } fr
import { GM_API_TYPE, STATUS } from "../../../consts";
import { GMGroupModel } from "../../../db/GMGroup";
import { GMRecordModel } from "../../../db/GMRecord";
import { GMUserGroupModel } from "../../../db/GMUserGroup";
import { gameData } from "../../../pubUtils/data";
import { resResult } from "../../../pubUtils/util";
@@ -16,17 +15,15 @@ var Filter = function(this: any, app: Application) {
Filter.prototype.before = async function (routeRecord: RouteRecord, msg: any, session: FrontendOrBackendSession, next: HandlerCallback) {
const uid = session.get('uid');
const groupId = session.get('groupId');
let route = routeRecord.route;
console.log('********uid', uid, route);
let dicApi = gameData.apiByUrl.get(route);
if(!dicApi) {
return next(new Error(), resResult(STATUS.GM_MISS_API));
}
let userGroup = await GMUserGroupModel.getUserGroupByUid(uid);
if(!userGroup) {
return next(new Error(), resResult(STATUS.GM_NO_AUTHORITY_GET));
}
let group = await GMGroupModel.getGroupById(userGroup.groupId);
let group = await GMGroupModel.getGroupById(groupId);
if(!group) {
return next(new Error(), resResult(STATUS.GM_NO_AUTHORITY_GET));
-34
View File
@@ -1,34 +0,0 @@
module.exports = {
'development': {
'type': 'development',
'name': '本地服'
},
'stable': {
'type': 'stable',
'name': '正式服'
},
'alpha': {
'type': 'alpha',
'name': '测试服'
},
'dev': {
'type': 'dev',
'name': '开发服'
},
'isbn': {
'type': 'isbn',
'name': '版号服'
},
'monitor': {
'type': 'monitor',
'name': '监控服'
},
'distribute': {
'type': 'distribute',
'name': '分布式测试'
},
'sq1': {
'type': 'sq1',
'name': '1月功能测试'
}
};