chore: 登录失败也记录日志

This commit is contained in:
xiaojunnuo
2026-07-12 22:28:51 +08:00
parent bab1df2c78
commit bfb3ee4c43
18 changed files with 78 additions and 57 deletions
@@ -14,18 +14,18 @@ export class AuditLogController extends BaseController {
@Post("/page", { description: Constants.per.authOnly, summary: "分页查询当前用户操作日志" })
async page(@Body(ALL) body: any) {
const { projectId, userId } = await this.getProjectUserIdRead();
const query: any = { }
const query: any = {};
if (projectId) {
//如果是项目级别,排除userId参数,因为日志这里userId不是-1 ,而是实际的用户
query.projectId = projectId;
}else{
} else {
query.userId = userId;
}
body.query = {
...body.query || {},
...(body.query || {}),
...query,
scope: "user"
}
scope: "user",
};
const pageRet = await this.auditService.page(body);
return this.ok(pageRet);
@@ -33,7 +33,7 @@ export class DnsPersistRecordController extends CrudController<DnsPersistRecordS
const { projectId, userId } = await this.getProjectUserIdWrite();
bean.projectId = projectId;
bean.userId = userId;
const res = await this.getService().add(bean);
const res = await this.getService().add(bean);
this.auditLog({ content: `新增了DNS持久验证记录(ID:${res.id})` });
return this.ok(res);
}