撒点记录登陆ip等信息 #13

Merged
longbot merged 1 commits from longbot/API:Test-add-log into main 2025-09-02 04:00:23 +00:00
1 changed files with 4 additions and 0 deletions
Showing only changes of commit 8a1b929692 - Show all commits

View File

@ -12,11 +12,15 @@ export class UserController {
@Inject() @Inject()
userService: UserService; userService: UserService;
@Inject()
ctx;
@ApiOkResponse({ @ApiOkResponse({
type: LoginRes, type: LoginRes,
}) })
@Post('/login') @Post('/login')
async login(@Body() body) { async login(@Body() body) {
this.ctx.logger.info('ip:', this.ctx.ip, '; path:', this.ctx.path, '; user:', body?.username);
try { try {
const result = await this.userService.login(body); const result = await this.userService.login(body);
return successResponse(result, '登录成功'); return successResponse(result, '登录成功');