59 lines
1.7 KiB
TypeScript
59 lines
1.7 KiB
TypeScript
import { Controller } from 'egg';
|
|
|
|
export default class AccountController extends Controller {
|
|
|
|
public async deviceLogin() {
|
|
const { ctx } = this;
|
|
const { token, isGuest, deviceId, platform, pkgName, serverType } = ctx.request.body;
|
|
ctx.body = await ctx.service.auth.deviceLogin(isGuest, token, deviceId, platform, pkgName, serverType);
|
|
}
|
|
|
|
public async getSms() {
|
|
const { ctx } = this;
|
|
const { tel } = ctx.request.body;
|
|
ctx.body = await ctx.service.auth.getSms(tel);
|
|
}
|
|
|
|
public async smsLogin() {
|
|
const { ctx } = this;
|
|
const { tel, code, platform, pkgName, serverType, deviceId } = ctx.request.body;
|
|
ctx.body = await ctx.service.auth.smsLogin(tel, deviceId, code, platform, pkgName, serverType);
|
|
}
|
|
|
|
public async setPassword() {
|
|
const { ctx } = this;
|
|
const { password } = ctx.request.body;
|
|
ctx.body = await ctx.service.auth.setPassword(password);
|
|
}
|
|
|
|
public async pwLogin() {
|
|
const { ctx } = this;
|
|
const { tel, deviceId, password } = ctx.request.body;
|
|
ctx.body = await ctx.service.auth.pwLogin(tel, deviceId, password);
|
|
}
|
|
|
|
public async checkRole() {
|
|
const { ctx } = this;
|
|
const { serverId } = ctx.request.body;
|
|
ctx.body = await ctx.service.auth.checkRole(serverId);
|
|
}
|
|
|
|
public async createRole() {
|
|
const { ctx } = this;
|
|
const { serverId, roleName } = ctx.request.body;
|
|
ctx.body = await ctx.service.auth.createRole(serverId, roleName);
|
|
}
|
|
|
|
public async bind() {
|
|
const { ctx } = this;
|
|
const { tel, code } = ctx.request.body;
|
|
ctx.body = await ctx.service.auth.bind(tel, code);
|
|
}
|
|
|
|
public async authentication() {
|
|
const { ctx } = this;
|
|
const { name, idNum } = ctx.request.body;
|
|
ctx.body = await ctx.service.auth.authentication(name, idNum);
|
|
}
|
|
}
|