m
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
return function (target, key) { decorator(target, key, paramIndex); }
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CommonCaptchaController = void 0;
|
||||
const openapi = require("@nestjs/swagger");
|
||||
const common_1 = require("@nestjs/common");
|
||||
const swagger_1 = require("@nestjs/swagger");
|
||||
const api_1 = require("../api");
|
||||
const captcha_vo_1 = require("../vo/captcha.vo");
|
||||
const captcha_query_dto_1 = require("../dto/captcha-query.dto");
|
||||
const public_decorator_1 = require("../decorator/public.decorator");
|
||||
class CommonCaptchaController {
|
||||
captchaService;
|
||||
constructor(captchaService) {
|
||||
this.captchaService = captchaService;
|
||||
}
|
||||
async getCaptcha(query) {
|
||||
const type = query.type ?? 'text';
|
||||
const size = query.size ?? 4;
|
||||
const result = type === 'math'
|
||||
? await this.captchaService.generateMath()
|
||||
: await this.captchaService.generate({ size });
|
||||
return api_1.Api.success({
|
||||
svg: result.svg,
|
||||
key: result.key,
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.CommonCaptchaController = CommonCaptchaController;
|
||||
__decorate([
|
||||
(0, public_decorator_1.AuthPublic)(),
|
||||
(0, common_1.Get)(),
|
||||
(0, swagger_1.ApiOperation)({ summary: '获取图形验证码' }),
|
||||
api_1.Api.ApiResponse({
|
||||
model: captcha_vo_1.CaptchaVo,
|
||||
}),
|
||||
openapi.ApiResponse({ status: 200 }),
|
||||
__param(0, (0, common_1.Query)()),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", [captcha_query_dto_1.CaptchaQueryDto]),
|
||||
__metadata("design:returntype", Promise)
|
||||
], CommonCaptchaController.prototype, "getCaptcha", null);
|
||||
//# sourceMappingURL=common_captcha.controller.js.map
|
||||
Reference in New Issue
Block a user