Files
wwjcloud-nest-v1/wwjcloud/src/common/auth/controllers/adminapi/CaptchaController.ts

35 lines
1.4 KiB
TypeScript
Raw Normal View History

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) {
return await this.captchaService.create(query);
}
@Post('check')
@ApiOperation({ summary: '一次校验验证码' })
@ApiResponse({ status: 200, description: '校验成功' })
async check(@Body() body: CaptchaCheckDto) {
return await this.captchaService.check(body);
}
@Post('verification')
@ApiOperation({ summary: '二次校验验证码' })
@ApiResponse({ status: 200, description: '校验成功' })
async verification(@Body() body: CaptchaVerificationDto) {
return await this.captchaService.verification(body);
}
}