25 lines
620 B
TypeScript
25 lines
620 B
TypeScript
import { Controller } from 'egg';
|
|
|
|
export default class LoginController extends Controller {
|
|
|
|
public async login() {
|
|
const { ctx } = this;
|
|
const {username, password} = ctx.request.body;
|
|
ctx.body = await ctx.service.gmUser.login(username, password);
|
|
}
|
|
|
|
public async currentUser() {
|
|
const { ctx } = this;
|
|
ctx.body = {
|
|
"status": "ok",
|
|
"data": ctx.user
|
|
};
|
|
}
|
|
|
|
public async createGmAccount() {
|
|
const { ctx } = this;
|
|
const {password, name, username, group} = ctx.request.body;
|
|
ctx.body = await ctx.service.gmUser.createGmAccount(name, username, password, group);
|
|
}
|
|
}
|