Files
ZYZ/web-server/app/controller/account.ts
2021-11-08 17:47:30 +08:00

71 lines
2.2 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 } = ctx.request.body;
ctx.body = await ctx.service.auth.createRole(serverId);
}
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;
const { channelType, pst, clientId, deviceId, platform, pkgName, serverType, getuiCID } = ctx.request.body;
ctx.body = await ctx.service.auth.channelLogin(channelType, clientId, pst, deviceId, platform, pkgName, serverType, getuiCID);
}
}