Files
ZYZ/web-server/app/controller/account.ts
2022-02-26 11:52:14 +08:00

70 lines
2.1 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, getuiCID } = ctx.request.body;
ctx.body = await ctx.service.auth.deviceLogin(isGuest, token, deviceId, platform, pkgName, serverType, getuiCID);
}
public async getSms() {
const { ctx } = this;
const { type, tel } = ctx.request.body;
ctx.body = await ctx.service.auth.getSms(type, tel);
}
public async smsLogin() {
const { ctx } = this;
const { tel, code, platform, pkgName, serverType, deviceId, getuiCID } = ctx.request.body;
ctx.body = await ctx.service.auth.smsLogin(tel, deviceId, code, platform, pkgName, serverType, getuiCID);
}
public async getSmsCode() {
const { ctx } = this;
const { tel } = ctx.request.query;
ctx.body = await ctx.service.auth.getSmsCode(tel);
}
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, getuiCID } = ctx.request.body;
ctx.body = await ctx.service.auth.pwLogin(tel, deviceId, password, getuiCID);
}
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, distinctId } = ctx.request.body;
ctx.body = await ctx.service.auth.createRole(serverId, distinctId);
}
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);
}
public async channelLogin() {
const { ctx } = this;
ctx.body = await ctx.service.auth.channelLogin(ctx.request.body);
}
}