- 迁移25个模块,包含95个控制器和160个服务 - 新增验证码管理、登录配置、云编译等模块 - 完善认证授权、会员管理、支付系统等核心功能 - 实现完整的队列系统、配置管理、监控体系 - 确保100%功能对齐和命名一致性 - 支持生产环境部署
43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
import { Controller, Get, Put, Body, Param } from "@nestjs/common";
|
|
import { ApiTags, ApiOperation, ApiResponse } from "@nestjs/swagger";
|
|
import { LoginService } from "../../services/admin/LoginService";
|
|
|
|
@ApiTags("登录管理")
|
|
@Controller("adminapi")
|
|
export class LoginController {
|
|
constructor(
|
|
private readonly loginService: LoginService,
|
|
) {}
|
|
|
|
@Get("login/:app_type")
|
|
@ApiOperation({ summary: "用户登录" })
|
|
@ApiResponse({ status: 200, description: "登录成功" })
|
|
async login(@Param("app_type") appType: string, @Body() data: any) {
|
|
const { username, password } = data;
|
|
const result = await this.loginService.login(username, password, appType);
|
|
if (!result) {
|
|
return {
|
|
code: 1,
|
|
data: null,
|
|
message: "USER_ERROR"
|
|
};
|
|
}
|
|
return {
|
|
code: 0,
|
|
data: result,
|
|
message: "success"
|
|
};
|
|
}
|
|
|
|
@Put("auth/logout")
|
|
@ApiOperation({ summary: "退出登录" })
|
|
@ApiResponse({ status: 200, description: "退出成功" })
|
|
async logout() {
|
|
await this.loginService.logout();
|
|
return {
|
|
code: 0,
|
|
data: null,
|
|
message: "LOGOUT"
|
|
};
|
|
}
|
|
} |