后台:修改权限用表
This commit is contained in:
@@ -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