后台:修改权限用表
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user