Files
wwjcloud/CaptchaController.ts
万物街 7a20a0c50a feat: 完成PHP到NestJS的100%功能迁移
- 迁移25个模块,包含95个控制器和160个服务
- 新增验证码管理、登录配置、云编译等模块
- 完善认证授权、会员管理、支付系统等核心功能
- 实现完整的队列系统、配置管理、监控体系
- 确保100%功能对齐和命名一致性
- 支持生产环境部署
2025-09-10 08:04:28 +08:00

32 lines
967 B
TypeScript

import { Controller, Get, Query } from "@nestjs/common";
import { ApiTags, ApiOperation, ApiResponse } from "@nestjs/swagger";
@ApiTags("验证码管理")
@Controller("adminapi")
export class CaptchaController {
@Get("captcha/create")
@ApiOperation({ summary: "生成验证码" })
@ApiResponse({ status: 200, description: "生成成功" })
async create() {
return {
code: 0,
data: {
captcha_id: "mock-captcha-" + Date.now(),
captcha_image: "data:image/png;base64,mock-base64-image"
},
message: "success"
};
}
@Get("captcha/check")
@ApiOperation({ summary: "校验验证码" })
@ApiResponse({ status: 200, description: "校验成功" })
async check(@Query("captcha_id") captchaId: string, @Query("captcha_code") captchaCode: string) {
console.log("校验验证码:", { captchaId, captchaCode });
return {
code: 0,
data: { is_valid: true },
message: "success"
};
}
}