2025-09-10 08:04:28 +08:00
|
|
|
import { Controller, Get, Post, Body, Query, UseGuards } from '@nestjs/common';
|
|
|
|
|
import { ApiTags, ApiOperation, ApiResponse } from '@nestjs/swagger';
|
|
|
|
|
import { JwtAuthGuard } from '../../guards/JwtAuthGuard';
|
|
|
|
|
import { RolesGuard } from '../../guards/RolesGuard';
|
|
|
|
|
import { Roles } from '../../decorators/RolesDecorator';
|
|
|
|
|
import { CaptchaService } from '../../services/admin/CaptchaService';
|
|
|
|
|
import { CaptchaCreateDto, CaptchaCheckDto, CaptchaVerificationDto } from '../../dto/admin/CaptchaDto';
|
|
|
|
|
|
|
|
|
|
@ApiTags('验证码管理')
|
|
|
|
|
@Controller('adminapi/auth/captcha')
|
|
|
|
|
export class CaptchaController {
|
|
|
|
|
constructor(private readonly captchaService: CaptchaService) {}
|
|
|
|
|
|
|
|
|
|
@Get('create')
|
|
|
|
|
@ApiOperation({ summary: '创建验证码' })
|
|
|
|
|
@ApiResponse({ status: 200, description: '创建成功' })
|
|
|
|
|
async create(@Query() query: CaptchaCreateDto) {
|
2025-09-13 08:35:59 +08:00
|
|
|
return await this.captchaService.create(query);
|
2025-09-10 08:04:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Post('check')
|
|
|
|
|
@ApiOperation({ summary: '一次校验验证码' })
|
|
|
|
|
@ApiResponse({ status: 200, description: '校验成功' })
|
|
|
|
|
async check(@Body() body: CaptchaCheckDto) {
|
2025-09-13 08:35:59 +08:00
|
|
|
return await this.captchaService.check(body);
|
2025-09-10 08:04:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Post('verification')
|
|
|
|
|
@ApiOperation({ summary: '二次校验验证码' })
|
|
|
|
|
@ApiResponse({ status: 200, description: '校验成功' })
|
|
|
|
|
async verification(@Body() body: CaptchaVerificationDto) {
|
2025-09-13 08:35:59 +08:00
|
|
|
return await this.captchaService.verification(body);
|
2025-09-10 08:04:28 +08:00
|
|
|
}
|
|
|
|
|
}
|