mirror of
https://github.com/certd/certd.git
synced 2026-07-15 18:27:33 +08:00
feat: 支持审计日志,操作日志
This commit is contained in:
@@ -2,6 +2,7 @@ import { ALL, Body, Controller, Inject, Post, Provide, Query } from "@midwayjs/c
|
||||
import { CrudController } from "@certd/lib-server";
|
||||
import { SiteInfoService } from "../../../modules/monitor/service/site-info-service.js";
|
||||
import { ApiTags } from "@midwayjs/swagger";
|
||||
import { AuditType } from "../../../modules/sys/enterprise/service/audit-constants.js";
|
||||
|
||||
@Provide()
|
||||
@Controller("/api/sys/monitor/site")
|
||||
@@ -14,6 +15,10 @@ export class SysSiteInfoController extends CrudController<SiteInfoService> {
|
||||
return this.service;
|
||||
}
|
||||
|
||||
getAuditType(): string {
|
||||
return AuditType.monitor;
|
||||
}
|
||||
|
||||
@Post("/page", { description: "sys:settings:view", summary: "管理员查询站点监控分页列表" })
|
||||
async page(@Body(ALL) body: any) {
|
||||
body.query = body.query ?? {};
|
||||
@@ -44,12 +49,16 @@ export class SysSiteInfoController extends CrudController<SiteInfoService> {
|
||||
|
||||
@Post("/delete", { description: "sys:settings:edit", summary: "管理员删除站点监控" })
|
||||
async delete(@Query("id") id: number) {
|
||||
return await super.delete(id);
|
||||
await super.delete(id);
|
||||
await this.auditLog({ content: `管理员删除了站点监控(ID:${id})` });
|
||||
return this.ok();
|
||||
}
|
||||
|
||||
@Post("/batchDelete", { description: "sys:settings:edit", summary: "管理员批量删除站点监控" })
|
||||
async batchDelete(@Body("ids") ids: number[]) {
|
||||
const count = ids.length;
|
||||
await this.service.delete(ids);
|
||||
await this.auditLog({ content: `管理员批量删除了${count}条站点监控` });
|
||||
return this.ok();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user