50 lines
1.5 KiB
TypeScript
50 lines
1.5 KiB
TypeScript
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 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 saveGmGroup() {
|
|
const { ctx } = this;
|
|
const {groupId, group, name, desc} = ctx.request.body;
|
|
ctx.body = await ctx.service.gmUser.saveGmGroup(groupId, 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, group, env, isEnable} = ctx.request.body;
|
|
ctx.body = await ctx.service.gmUser.saveGmGroupToUser(uid, group, env, isEnable);
|
|
}
|
|
}
|