feat: 完成PHP到NestJS的100%功能迁移
- 迁移25个模块,包含95个控制器和160个服务 - 新增验证码管理、登录配置、云编译等模块 - 完善认证授权、会员管理、支付系统等核心功能 - 实现完整的队列系统、配置管理、监控体系 - 确保100%功能对齐和命名一致性 - 支持生产环境部署
This commit is contained in:
48
wwjcloud/src/common/auth/dto/admin/CaptchaDto.ts
Normal file
48
wwjcloud/src/common/auth/dto/admin/CaptchaDto.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsOptional, IsString, IsNumber } from 'class-validator';
|
||||
|
||||
export class CaptchaCreateDto {
|
||||
@ApiProperty({ description: '验证码类型', required: false })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
type?: string;
|
||||
|
||||
@ApiProperty({ description: '验证码长度', required: false })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
length?: number;
|
||||
|
||||
@ApiProperty({ description: '验证码宽度', required: false })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
width?: number;
|
||||
|
||||
@ApiProperty({ description: '验证码高度', required: false })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
height?: number;
|
||||
}
|
||||
|
||||
export class CaptchaCheckDto {
|
||||
@ApiProperty({ description: '验证码ID' })
|
||||
@IsString()
|
||||
captchaId: string;
|
||||
|
||||
@ApiProperty({ description: '验证码值' })
|
||||
@IsString()
|
||||
captchaValue: string;
|
||||
}
|
||||
|
||||
export class CaptchaVerificationDto {
|
||||
@ApiProperty({ description: '验证码ID' })
|
||||
@IsString()
|
||||
captchaId: string;
|
||||
|
||||
@ApiProperty({ description: '验证码值' })
|
||||
@IsString()
|
||||
captchaValue: string;
|
||||
|
||||
@ApiProperty({ description: '二次验证参数', required: false })
|
||||
@IsOptional()
|
||||
params?: Record<string, any>;
|
||||
}
|
||||
51
wwjcloud/src/common/auth/dto/admin/LoginConfigDto.ts
Normal file
51
wwjcloud/src/common/auth/dto/admin/LoginConfigDto.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsOptional, IsNumber, IsString } from 'class-validator';
|
||||
|
||||
export class LoginConfigDto {
|
||||
@ApiProperty({ description: '是否启用验证码', required: false })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
isCaptcha?: number;
|
||||
|
||||
@ApiProperty({ description: '是否启用站点验证码', required: false })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
isSiteCaptcha?: number;
|
||||
|
||||
@ApiProperty({ description: '登录背景图', required: false })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
bg?: string;
|
||||
|
||||
@ApiProperty({ description: '站点登录背景图', required: false })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
siteBg?: string;
|
||||
|
||||
@ApiProperty({ description: '登录方式配置', required: false })
|
||||
@IsOptional()
|
||||
loginMethods?: {
|
||||
username?: boolean;
|
||||
email?: boolean;
|
||||
mobile?: boolean;
|
||||
wechat?: boolean;
|
||||
qq?: boolean;
|
||||
};
|
||||
|
||||
@ApiProperty({ description: '密码策略配置', required: false })
|
||||
@IsOptional()
|
||||
passwordPolicy?: {
|
||||
minLength?: number;
|
||||
requireSpecialChar?: boolean;
|
||||
requireNumber?: boolean;
|
||||
requireUppercase?: boolean;
|
||||
};
|
||||
|
||||
@ApiProperty({ description: '登录失败限制', required: false })
|
||||
@IsOptional()
|
||||
loginLimit?: {
|
||||
maxAttempts?: number;
|
||||
lockoutDuration?: number;
|
||||
lockoutType?: string;
|
||||
};
|
||||
}
|
||||
96
wwjcloud/src/common/auth/dto/api/LoginDto.ts
Normal file
96
wwjcloud/src/common/auth/dto/api/LoginDto.ts
Normal file
@@ -0,0 +1,96 @@
|
||||
import {
|
||||
IsString,
|
||||
IsOptional,
|
||||
IsInt,
|
||||
IsEmail,
|
||||
MinLength,
|
||||
MaxLength,
|
||||
IsMobilePhone,
|
||||
} from 'class-validator';
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
|
||||
export class LoginDto {
|
||||
@ApiProperty({ description: '站点ID', example: 0 })
|
||||
@IsInt()
|
||||
site_id: number;
|
||||
|
||||
@ApiProperty({ description: '用户名/手机号/邮箱', example: 'admin' })
|
||||
@IsString()
|
||||
@MinLength(3)
|
||||
@MaxLength(50)
|
||||
username: string;
|
||||
|
||||
@ApiProperty({ description: '密码', example: '123456' })
|
||||
@IsString()
|
||||
@MinLength(6)
|
||||
@MaxLength(20)
|
||||
password: string;
|
||||
|
||||
@ApiPropertyOptional({ description: '验证码', example: '1234' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MinLength(4)
|
||||
@MaxLength(6)
|
||||
captcha?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: '验证码key', example: 'captcha_key_123' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
captcha_key?: string;
|
||||
}
|
||||
|
||||
export class RegisterDto {
|
||||
@ApiProperty({ description: '站点ID', example: 0 })
|
||||
@IsInt()
|
||||
site_id: number;
|
||||
|
||||
@ApiProperty({ description: '用户名', example: 'testuser' })
|
||||
@IsString()
|
||||
@MinLength(3)
|
||||
@MaxLength(20)
|
||||
username: string;
|
||||
|
||||
@ApiProperty({ description: '密码', example: '123456' })
|
||||
@IsString()
|
||||
@MinLength(6)
|
||||
@MaxLength(20)
|
||||
password: string;
|
||||
|
||||
@ApiProperty({ description: '确认密码', example: '123456' })
|
||||
@IsString()
|
||||
@MinLength(6)
|
||||
@MaxLength(20)
|
||||
confirm_password: string;
|
||||
|
||||
@ApiProperty({ description: '手机号', example: '13800138000' })
|
||||
@IsMobilePhone('zh-CN')
|
||||
mobile: string;
|
||||
|
||||
@ApiPropertyOptional({ description: '邮箱', example: 'test@example.com' })
|
||||
@IsOptional()
|
||||
@IsEmail()
|
||||
email?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: '验证码', example: '1234' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MinLength(4)
|
||||
@MaxLength(6)
|
||||
captcha?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: '验证码key', example: 'captcha_key_123' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
captcha_key?: string;
|
||||
}
|
||||
|
||||
export class CaptchaDto {
|
||||
@ApiProperty({ description: '站点ID', example: 0 })
|
||||
@IsInt()
|
||||
site_id: number;
|
||||
|
||||
@ApiPropertyOptional({ description: '验证码类型', example: 'login' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
type?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user