后台添加权限管理

This commit is contained in:
luying
2020-09-22 11:10:45 +08:00
parent bcbed5959f
commit 780562979e
13 changed files with 494 additions and 31 deletions
+49
View File
@@ -0,0 +1,49 @@
import { Controller } from 'egg';
export default class GmController extends Controller {
public async getGmList() {
const { ctx } = this;
ctx.body = await ctx.service.gmUser.getGmList();
}
public async createGmAccount() {
const { ctx } = this;
const {password, name, username} = ctx.request.body;
ctx.body = await ctx.service.gmUser.createGmAccount(name, username, password);
}
public async getApiList() {
const { ctx } = this;
ctx.body = await ctx.service.gmUser.getApiList();
}
public async saveApi() {
const { ctx } = this;
const {api, name} = ctx.request.body;
ctx.body = await ctx.service.gmUser.saveApi(api, name);
}
public async getGroupList() {
const { ctx } = this;
ctx.body = await ctx.service.gmUser.getGroupList();
}
public async createGmGroup() {
const { ctx } = this;
const {group, name, desc} = ctx.request.body;
ctx.body = await ctx.service.gmUser.createGmGroup(group, name, desc);
}
public async saveGmApiToGroup() {
const { ctx } = this;
const {id, apis} = ctx.request.body;
ctx.body = await ctx.service.gmUser.saveGmApiToGroup(id, apis);
}
public async saveGmGroupToUser() {
const { ctx } = this;
const {uid, groups} = ctx.request.body;
ctx.body = await ctx.service.gmUser.saveGmGroupToUser(uid, groups);
}
}
+23 -4
View File
@@ -15,10 +15,29 @@ export default class LoginController extends Controller {
"data": ctx.user
};
}
public async createGmAccount() {
public async getMenu() {
const { ctx } = this;
const {password, name, username, group} = ctx.request.body;
ctx.body = await ctx.service.gmUser.createGmAccount(name, username, password, group);
ctx.body = {
"status": "ok",
"data": [
{
path: '/test',
authority: ['admin'],
routes: [
{
path: '/test/create-role',
authority: ['admin'],
},
{
path: '/test/create-data',
authority: ['admin'],
}
],
}
]
}
}
}