From 8e7c63635d6a9c1eed80fcf3f598facda15e726e Mon Sep 17 00:00:00 2001 From: cool_team Date: Fri, 25 Mar 2022 16:32:59 +0800 Subject: [PATCH] 5.x --- src/modules/base/controller/admin/open.ts | 4 +++- src/modules/base/dto/login.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/modules/base/controller/admin/open.ts b/src/modules/base/controller/admin/open.ts index bf2dd23..46e1b00 100644 --- a/src/modules/base/controller/admin/open.ts +++ b/src/modules/base/controller/admin/open.ts @@ -12,6 +12,7 @@ import { LoginDTO } from '../../dto/login'; import { BaseSysLoginService } from '../../service/sys/login'; import { BaseSysParamService } from '../../service/sys/param'; import { Context } from '@midwayjs/koa'; +import { Validate } from '@midwayjs/validate'; /** * 不需要登录的后台接口 @@ -53,7 +54,8 @@ export class BaseOpenController extends BaseController { * @param login */ @Post('/login', { summary: '登录' }) - async login(@Body(ALL) login: LoginDTO) { + @Validate() + async login(@Body() login: LoginDTO) { return this.ok(await this.baseSysLoginService.login(login)); } diff --git a/src/modules/base/dto/login.ts b/src/modules/base/dto/login.ts index 8ae3333..5b4b30c 100644 --- a/src/modules/base/dto/login.ts +++ b/src/modules/base/dto/login.ts @@ -16,6 +16,6 @@ export class LoginDTO { captchaId: string; // 验证码 - @Rule(RuleType.string().required()) + @Rule(RuleType.required()) verifyCode: number; }