mirror of
https://github.com/certd/certd.git
synced 2026-06-30 00:07:37 +08:00
feat: 新增管理员针对用户流水线和证书监控管理功能
1. 新增后台管理页面:用户流水线管理、用户证书监控管理 2. 新增对应前后端接口与控制器 3. 添加多语言国际化配置 4. 修复导入顺序与多余空行问题 5. 补充证书申请类型选项
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
import { ALL, Body, Controller, Inject, Post, Provide, Query } from "@midwayjs/core";
|
||||
import { CrudController } from "@certd/lib-server";
|
||||
import { SiteInfoService } from "../../../modules/monitor/service/site-info-service.js";
|
||||
import { ApiTags } from "@midwayjs/swagger";
|
||||
|
||||
@Provide()
|
||||
@Controller("/api/sys/monitor/site")
|
||||
@ApiTags(["sys-monitor"])
|
||||
export class SysSiteInfoController extends CrudController<SiteInfoService> {
|
||||
@Inject()
|
||||
service: SiteInfoService;
|
||||
|
||||
getService(): SiteInfoService {
|
||||
return this.service;
|
||||
}
|
||||
|
||||
@Post("/page", { description: "sys:settings:view", summary: "管理员查询站点监控分页列表" })
|
||||
async page(@Body(ALL) body: any) {
|
||||
body.query = body.query ?? {};
|
||||
const certDomains = body.query.certDomains;
|
||||
const domain = body.query.domain;
|
||||
const name = body.query.name;
|
||||
delete body.query.certDomains;
|
||||
delete body.query.domain;
|
||||
delete body.query.name;
|
||||
const res = await this.service.page({
|
||||
query: body.query,
|
||||
page: body.page,
|
||||
sort: body.sort,
|
||||
buildQuery: bq => {
|
||||
if (domain) {
|
||||
bq.andWhere("domain like :domain", { domain: `%${domain}%` });
|
||||
}
|
||||
if (certDomains) {
|
||||
bq.andWhere("cert_domains like :cert_domains", { cert_domains: `%${certDomains}%` });
|
||||
}
|
||||
if (name) {
|
||||
bq.andWhere("name like :name", { name: `%${name}%` });
|
||||
}
|
||||
},
|
||||
});
|
||||
return this.ok(res);
|
||||
}
|
||||
|
||||
@Post("/delete", { description: "sys:settings:edit", summary: "管理员删除站点监控" })
|
||||
async delete(@Query("id") id: number) {
|
||||
return await super.delete(id);
|
||||
}
|
||||
|
||||
@Post("/batchDelete", { description: "sys:settings:edit", summary: "管理员批量删除站点监控" })
|
||||
async batchDelete(@Body("ids") ids: number[]) {
|
||||
await this.service.delete(ids);
|
||||
return this.ok();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
import { ALL, Body, Controller, Inject, Post, Provide, Query } from "@midwayjs/core";
|
||||
import { CrudController } from "@certd/lib-server";
|
||||
import { ApiTags } from "@midwayjs/swagger";
|
||||
import { PipelineService } from "../../../modules/pipeline/service/pipeline-service.js";
|
||||
import { checkPlus } from "@certd/plus-core";
|
||||
|
||||
@Provide()
|
||||
@Controller("/api/sys/pipeline")
|
||||
@ApiTags(["sys-pipeline"])
|
||||
export class SysPipelineController extends CrudController<PipelineService> {
|
||||
@Inject()
|
||||
service: PipelineService;
|
||||
|
||||
getService(): PipelineService {
|
||||
return this.service;
|
||||
}
|
||||
|
||||
@Post("/page", { description: "sys:settings:view", summary: "管理员查询用户流水线分页列表" })
|
||||
async page(@Body(ALL) body: any) {
|
||||
body.query = body.query ?? {};
|
||||
const title = body.query.title;
|
||||
delete body.query.title;
|
||||
|
||||
if (!body.sort || !body.sort?.prop) {
|
||||
body.sort = { prop: "order", asc: false };
|
||||
}
|
||||
|
||||
const res = await this.service.page({
|
||||
query: body.query,
|
||||
page: body.page,
|
||||
sort: body.sort,
|
||||
buildQuery: bq => {
|
||||
if (title) {
|
||||
bq.andWhere("(title like :title or content like :content)", { title: `%${title}%`, content: `%${title}%` });
|
||||
}
|
||||
},
|
||||
});
|
||||
return this.ok(res);
|
||||
}
|
||||
|
||||
@Post("/delete", { description: "sys:settings:edit", summary: "管理员删除用户流水线" })
|
||||
async delete(@Query("id") id: number) {
|
||||
await this.service.delete(id);
|
||||
return this.ok();
|
||||
}
|
||||
|
||||
@Post("/batchDelete", { description: "sys:settings:edit", summary: "管理员批量删除用户流水线" })
|
||||
async batchDelete(@Body("ids") ids: number[]) {
|
||||
checkPlus();
|
||||
await this.service.batchDelete(ids);
|
||||
return this.ok();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user