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 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, groups} = ctx.request.body; ctx.body = await ctx.service.gmUser.saveGmGroupToUser(uid, groups); } }