feat: 支持审计日志,操作日志

This commit is contained in:
xiaojunnuo
2026-07-12 02:29:54 +08:00
parent 4250d0e266
commit f2855d6dac
83 changed files with 1252 additions and 1341 deletions
@@ -13,11 +13,20 @@ export class AuditLogController extends BaseController {
@Post("/page", { description: Constants.per.authOnly, summary: "分页查询当前用户操作日志" })
async page(@Body(ALL) body: any) {
const userId = this.getUserId();
if (!body.query) {
body.query = {};
const { projectId, userId } = await this.getProjectUserIdRead();
const query: any = { }
if (projectId) {
//如果是项目级别,排除userId参数,因为日志这里userId不是-1 ,而是实际的用户
query.projectId = projectId;
}else{
query.userId = userId;
}
body.query.userId = userId;
body.query = {
...body.query || {},
...query,
scope: "user"
}
const pageRet = await this.auditService.page(body);
return this.ok(pageRet);
}