chore: format

This commit is contained in:
xiaojunnuo
2026-05-31 01:41:33 +08:00
parent acd440106b
commit 4b57a0d729
557 changed files with 12530 additions and 14039 deletions
@@ -13,8 +13,8 @@ import { CertReader } from "@certd/plugin-lib";
/**
*/
@Provide()
@Controller('/api/monitor/cert')
@ApiTags(['cert'])
@Controller("/api/monitor/cert")
@ApiTags(["cert"])
export class CertInfoController extends CrudController<CertInfoService> {
@Inject()
service: CertInfoService;
@@ -30,12 +30,12 @@ export class CertInfoController extends CrudController<CertInfoService> {
return this.service;
}
@Post('/page', { description: Constants.per.authOnly, summary: "查询证书分页列表" })
@Post("/page", { description: Constants.per.authOnly, summary: "查询证书分页列表" })
async page(@Body(ALL) body: any) {
body.query = body.query ?? {};
const { projectId, userId } = await this.getProjectUserIdRead()
body.query.projectId = projectId
const { projectId, userId } = await this.getProjectUserIdRead();
body.query.projectId = projectId;
body.query.userId = userId;
const domains = body.query?.domains;
delete body.query.domains;
@@ -49,21 +49,21 @@ export class CertInfoController extends CrudController<CertInfoService> {
query: body.query,
page: body.page,
sort: body.sort,
buildQuery: (bq) => {
buildQuery: bq => {
if (domains) {
bq.andWhere('domains like :domains', { domains: `%${domains}%` });
bq.andWhere("domains like :domains", { domains: `%${domains}%` });
}
if (expiresLeft) {
const willExpire = dayjs().add(DEFAULT_WILL_EXPIRE_DAYS, 'day').valueOf();
const willExpire = dayjs().add(DEFAULT_WILL_EXPIRE_DAYS, "day").valueOf();
if (expiresLeft === "expired") {
bq.andWhere('expires_time < :now', { now: Date.now() });
bq.andWhere("expires_time < :now", { now: Date.now() });
} else if (expiresLeft === "expiring") {
bq.andWhere('expires_time <= :willExpire and expires_time > :now', { willExpire, now: Date.now() });
bq.andWhere("expires_time <= :willExpire and expires_time > :now", { willExpire, now: Date.now() });
} else if (expiresLeft === "noExpired") {
bq.andWhere('expires_time > :willExpire', { willExpire });
bq.andWhere("expires_time > :willExpire", { willExpire });
}
}
}
},
});
const records = res.records;
@@ -79,71 +79,70 @@ export class CertInfoController extends CrudController<CertInfoService> {
return this.ok(res);
}
@Post('/list', { description: Constants.per.authOnly, summary: "查询证书列表" })
@Post("/list", { description: Constants.per.authOnly, summary: "查询证书列表" })
async list(@Body(ALL) body: any) {
body.query = body.query ?? {};
const { projectId, userId } = await this.getProjectUserIdRead()
body.query.projectId = projectId
const { projectId, userId } = await this.getProjectUserIdRead();
body.query.projectId = projectId;
body.query.userId = userId;
return await super.list(body);
}
@Post('/getOptionsByIds', { description: Constants.per.authOnly, summary: "根据ID列表获取证书选项" })
async getOptionsByIds(@Body(ALL) body: {ids:any[]}) {
const { projectId, userId } = await this.getProjectUserIdRead()
@Post("/getOptionsByIds", { description: Constants.per.authOnly, summary: "根据ID列表获取证书选项" })
async getOptionsByIds(@Body(ALL) body: { ids: any[] }) {
const { projectId, userId } = await this.getProjectUserIdRead();
const list = await this.service.list({
query:{
query: {
projectId,
userId,
},
buildQuery: (bq: SelectQueryBuilder<any>) => {
bq.andWhere('id in (:...ids)', { ids: body.ids });
}
})
bq.andWhere("id in (:...ids)", { ids: body.ids });
},
});
const safeList =list.map((item:any) => {
const domainsArr = item.domains? item.domains.split(',') : [];
const safeList = list.map((item: any) => {
const domainsArr = item.domains ? item.domains.split(",") : [];
return {
id: item.id,
domain: item.domain,
domains:domainsArr,
domains: domainsArr,
userId: item.userId,
}
})
};
});
return this.ok(safeList);
}
@Post('/add', { description: Constants.per.authOnly, summary: "添加证书" })
@Post("/add", { description: Constants.per.authOnly, summary: "添加证书" })
async add(@Body(ALL) bean: any) {
const { projectId, userId } = await this.getProjectUserIdWrite()
bean.projectId = projectId
const { projectId, userId } = await this.getProjectUserIdWrite();
bean.projectId = projectId;
bean.userId = userId;
return await super.add(bean);
}
@Post('/update', { description: Constants.per.authOnly, summary: "更新证书" })
@Post("/update", { description: Constants.per.authOnly, summary: "更新证书" })
async update(@Body(ALL) bean) {
await this.checkOwner(this.service,bean.id,"write");
await this.checkOwner(this.service, bean.id, "write");
delete bean.userId;
delete bean.projectId;
return await super.update(bean);
}
@Post('/info', { description: Constants.per.authOnly, summary: "查询证书详情" })
async info(@Query('id') id: number) {
await this.checkOwner(this.service,id,"read");
@Post("/info", { description: Constants.per.authOnly, summary: "查询证书详情" })
async info(@Query("id") id: number) {
await this.checkOwner(this.service, id, "read");
return await super.info(id);
}
@Post('/delete', { description: Constants.per.authOnly, summary: "删除证书" })
async delete(@Query('id') id: number) {
await this.checkOwner(this.service,id,"write");
@Post("/delete", { description: Constants.per.authOnly, summary: "删除证书" })
async delete(@Query("id") id: number) {
await this.checkOwner(this.service, id, "write");
return await super.delete(id);
}
@Post('/all', { description: Constants.per.authOnly, summary: "查询所有证书" })
@Post("/all", { description: Constants.per.authOnly, summary: "查询所有证书" })
async all() {
const { projectId, userId } = await this.getProjectUserIdRead()
const { projectId, userId } = await this.getProjectUserIdRead();
const list: any = await this.service.find({
where: {
projectId,
@@ -153,32 +152,30 @@ export class CertInfoController extends CrudController<CertInfoService> {
return this.ok(list);
}
@Post('/getCert', { description: Constants.per.authOnly, summary: "获取证书信息" })
async getCert(@Query('id') id: number) {
await this.checkOwner(this.getService(),id,"read");
@Post("/getCert", { description: Constants.per.authOnly, summary: "获取证书信息" })
async getCert(@Query("id") id: number) {
await this.checkOwner(this.getService(), id, "read");
const certInfoEntity = await this.service.info(id);
const certInfo = JSON.parse(certInfoEntity.certInfo);
if (certInfo?.crt) {
const certReader = new CertReader(certInfo);
certInfo.detail = certReader.detail
certInfo.detail = certReader.detail;
}
return this.ok(certInfo);
}
@Get('/download', { description: Constants.per.authOnly, summary: "下载证书文件" })
async download(@Query('id') id: number) {
const {userId,projectId} =await this.checkOwner(this.getService(),id,"read");
const certInfo = await this.getService().info(id)
@Get("/download", { description: Constants.per.authOnly, summary: "下载证书文件" })
async download(@Query("id") id: number) {
const { userId, projectId } = await this.checkOwner(this.getService(), id, "read");
const certInfo = await this.getService().info(id);
if (certInfo == null) {
throw new CommonException('file not found');
throw new CommonException("file not found");
}
if (certInfo.userId !== userId) {
throw new CommonException('file not found');
throw new CommonException("file not found");
}
if (projectId && certInfo.projectId !== projectId) {
throw new CommonException('file not found');
throw new CommonException("file not found");
}
// koa send file
// 下载文件的名称
@@ -186,12 +183,12 @@ export class CertInfoController extends CrudController<CertInfoService> {
// 要下载的文件的完整路径
const path = certInfo.certFile;
if (!path) {
throw new CommonException('file not found');
throw new CommonException("file not found");
}
logger.info(`download:${path}`);
// 以流的形式下载文件
this.ctx.attachment(path);
this.ctx.set('Content-Type', 'application/octet-stream');
this.ctx.set("Content-Type", "application/octet-stream");
return fs.createReadStream(path);
}
@@ -8,8 +8,8 @@ import { AuthService } from "../../../modules/sys/authority/service/auth-service
/**
*/
@Provide()
@Controller('/api/monitor/job-history')
@ApiTags(['monitor'])
@Controller("/api/monitor/job-history")
@ApiTags(["monitor"])
export class JobHistoryController extends CrudController<JobHistoryService> {
@Inject()
service: JobHistoryService;
@@ -22,12 +22,12 @@ export class JobHistoryController extends CrudController<JobHistoryService> {
return this.service;
}
@Post('/page', { description: Constants.per.authOnly, summary: "查询监控运行历史分页列表" })
@Post("/page", { description: Constants.per.authOnly, summary: "查询监控运行历史分页列表" })
async page(@Body(ALL) body: any) {
const { projectId, userId } = await this.getProjectUserIdRead()
const { projectId, userId } = await this.getProjectUserIdRead();
body.query = body.query ?? {};
body.query.userId = userId;
body.query.projectId = projectId
body.query.projectId = projectId;
const res = await this.service.page({
query: body.query,
page: body.page,
@@ -36,30 +36,30 @@ export class JobHistoryController extends CrudController<JobHistoryService> {
return this.ok(res);
}
@Post('/list', { description: Constants.per.authOnly, summary: "查询监控运行历史列表" })
@Post("/list", { description: Constants.per.authOnly, summary: "查询监控运行历史列表" })
async list(@Body(ALL) body: any) {
body.query = body.query ?? {};
const { projectId, userId } = await this.getProjectUserIdRead()
const { projectId, userId } = await this.getProjectUserIdRead();
body.query.userId = userId;
body.query.projectId = projectId
body.query.projectId = projectId;
return await super.list(body);
}
@Post('/info', { description: Constants.per.authOnly, summary: "查询监控运行历史详情" })
async info(@Query('id') id: number) {
await this.checkOwner(this.service,id,"read");
@Post("/info", { description: Constants.per.authOnly, summary: "查询监控运行历史详情" })
async info(@Query("id") id: number) {
await this.checkOwner(this.service, id, "read");
return await super.info(id);
}
@Post('/delete', { description: Constants.per.authOnly, summary: "删除监控运行历史" })
async delete(@Query('id') id: number) {
await this.checkOwner(this.service,id,"write");
@Post("/delete", { description: Constants.per.authOnly, summary: "删除监控运行历史" })
async delete(@Query("id") id: number) {
await this.checkOwner(this.service, id, "write");
return await super.delete(id);
}
@Post('/batchDelete', { description: Constants.per.authOnly, summary: "批量删除监控运行历史" })
async batchDelete(@Body('ids') ids: number[]) {
const { projectId, userId } = await this.getProjectUserIdWrite()
await this.service.batchDelete(ids,userId,projectId);
@Post("/batchDelete", { description: Constants.per.authOnly, summary: "批量删除监控运行历史" })
async batchDelete(@Body("ids") ids: number[]) {
const { projectId, userId } = await this.getProjectUserIdWrite();
await this.service.batchDelete(ids, userId, projectId);
return this.ok();
}
}
@@ -4,15 +4,15 @@ import { AuthService } from "../../../modules/sys/authority/service/auth-service
import { SiteInfoService } from "../../../modules/monitor/service/site-info-service.js";
import { UserSiteMonitorSetting } from "../../../modules/mine/service/models.js";
import { merge } from "lodash-es";
import {SiteIpService} from "../../../modules/monitor/service/site-ip-service.js";
import { SiteIpService } from "../../../modules/monitor/service/site-ip-service.js";
import { utils } from "@certd/basic";
import { ApiTags } from "@midwayjs/swagger";
/**
*/
@Provide()
@Controller('/api/monitor/site')
@ApiTags(['monitor'])
@Controller("/api/monitor/site")
@ApiTags(["monitor"])
export class SiteInfoController extends CrudController<SiteInfoService> {
@Inject()
service: SiteInfoService;
@@ -25,11 +25,11 @@ export class SiteInfoController extends CrudController<SiteInfoService> {
return this.service;
}
@Post('/page', { description: Constants.per.authOnly, summary: "查询站点监控分页列表" })
@Post("/page", { description: Constants.per.authOnly, summary: "查询站点监控分页列表" })
async page(@Body(ALL) body: any) {
body.query = body.query ?? {};
const { projectId, userId } = await this.getProjectUserIdRead()
body.query.projectId = projectId
const { projectId, userId } = await this.getProjectUserIdRead();
body.query.projectId = projectId;
body.query.userId = userId;
const certDomains = body.query.certDomains;
const domain = body.query.domain;
@@ -41,34 +41,34 @@ export class SiteInfoController extends CrudController<SiteInfoService> {
query: body.query,
page: body.page,
sort: body.sort,
buildQuery: (bq) => {
buildQuery: bq => {
if (domain) {
bq.andWhere('domain like :domain', { domain: `%${domain}%` });
bq.andWhere("domain like :domain", { domain: `%${domain}%` });
}
if (certDomains) {
bq.andWhere('cert_domains like :cert_domains', { cert_domains: `%${certDomains}%` });
bq.andWhere("cert_domains like :cert_domains", { cert_domains: `%${certDomains}%` });
}
if (name) {
bq.andWhere('name like :name', { name: `%${name}%` });
bq.andWhere("name like :name", { name: `%${name}%` });
}
}
},
});
return this.ok(res);
}
@Post('/list', { description: Constants.per.authOnly, summary: "查询站点监控列表" })
@Post("/list", { description: Constants.per.authOnly, summary: "查询站点监控列表" })
async list(@Body(ALL) body: any) {
body.query = body.query ?? {};
const { projectId, userId } = await this.getProjectUserIdRead()
body.query.projectId = projectId
const { projectId, userId } = await this.getProjectUserIdRead();
body.query.projectId = projectId;
body.query.userId = userId;
return await super.list(body);
}
@Post('/add', { description: Constants.per.authOnly, summary: "添加站点监控" })
@Post("/add", { description: Constants.per.authOnly, summary: "添加站点监控" })
async add(@Body(ALL) bean: any) {
const { projectId, userId } = await this.getProjectUserIdWrite()
bean.projectId = projectId
const { projectId, userId } = await this.getProjectUserIdWrite();
bean.projectId = projectId;
bean.userId = userId;
const res = await this.service.add(bean);
const entity = await this.service.info(res.id);
@@ -78,9 +78,9 @@ export class SiteInfoController extends CrudController<SiteInfoService> {
return this.ok(res);
}
@Post('/update', { description: Constants.per.authOnly, summary: "更新站点监控" })
@Post("/update", { description: Constants.per.authOnly, summary: "更新站点监控" })
async update(@Body(ALL) bean) {
await this.checkOwner(this.service,bean.id,"write");
await this.checkOwner(this.service, bean.id, "write");
delete bean.userId;
delete bean.projectId;
await this.service.update(bean);
@@ -90,89 +90,86 @@ export class SiteInfoController extends CrudController<SiteInfoService> {
}
return this.ok();
}
@Post('/info', { description: Constants.per.authOnly, summary: "查询站点监控详情" })
async info(@Query('id') id: number) {
await this.checkOwner(this.service,id,"read");
@Post("/info", { description: Constants.per.authOnly, summary: "查询站点监控详情" })
async info(@Query("id") id: number) {
await this.checkOwner(this.service, id, "read");
return await super.info(id);
}
@Post('/delete', { description: Constants.per.authOnly, summary: "删除站点监控" })
async delete(@Query('id') id: number) {
await this.checkOwner(this.service,id,"write");
@Post("/delete", { description: Constants.per.authOnly, summary: "删除站点监控" })
async delete(@Query("id") id: number) {
await this.checkOwner(this.service, id, "write");
return await super.delete(id);
}
@Post('/batchDelete', { description: Constants.per.authOnly, summary: "批量删除站点监控" })
@Post("/batchDelete", { description: Constants.per.authOnly, summary: "批量删除站点监控" })
async batchDelete(@Body(ALL) body: any) {
const { projectId, userId } = await this.getProjectUserIdWrite()
await this.service.batchDelete(body.ids,userId,projectId);
const { projectId, userId } = await this.getProjectUserIdWrite();
await this.service.batchDelete(body.ids, userId, projectId);
return this.ok();
}
@Post('/check', { description: Constants.per.authOnly, summary: "检查站点监控" })
async check(@Body('id') id: number) {
await this.checkOwner(this.service,id,"read");
@Post("/check", { description: Constants.per.authOnly, summary: "检查站点监控" })
async check(@Body("id") id: number) {
await this.checkOwner(this.service, id, "read");
await this.service.check(id, true, 0);
await utils.sleep(1000);
return this.ok();
}
@Post('/checkAll', { description: Constants.per.authOnly, summary: "检查所有站点监控" })
@Post("/checkAll", { description: Constants.per.authOnly, summary: "检查所有站点监控" })
async checkAll() {
const { projectId, userId } = await this.getProjectUserIdWrite()
this.service.triggerJobOnce(userId,projectId);
const { projectId, userId } = await this.getProjectUserIdWrite();
this.service.triggerJobOnce(userId, projectId);
return this.ok();
}
@Post('/import', { description: Constants.per.authOnly, summary: "导入站点监控" })
@Post("/import", { description: Constants.per.authOnly, summary: "导入站点监控" })
async doImport(@Body(ALL) body: any) {
const { projectId, userId } = await this.getProjectUserIdWrite()
const { projectId, userId } = await this.getProjectUserIdWrite();
await this.service.doImport({
text:body.text,
groupId:body.groupId,
text: body.text,
groupId: body.groupId,
userId,
projectId
})
return this.ok();
}
@Post('/ipCheckChange', { description: Constants.per.authOnly, summary: "修改IP检查设置" })
async ipCheckChange(@Body(ALL) bean: any) {
await this.checkOwner(this.service,bean.id,"read");
await this.service.ipCheckChange({
id: bean.id,
ipCheck: bean.ipCheck
projectId,
});
return this.ok();
}
@Post('/disabledChange', { description: Constants.per.authOnly, summary: "修改禁用状态" })
@Post("/ipCheckChange", { description: Constants.per.authOnly, summary: "修改IP检查设置" })
async ipCheckChange(@Body(ALL) bean: any) {
await this.checkOwner(this.service, bean.id, "read");
await this.service.ipCheckChange({
id: bean.id,
ipCheck: bean.ipCheck,
});
return this.ok();
}
@Post("/disabledChange", { description: Constants.per.authOnly, summary: "修改禁用状态" })
async disabledChange(@Body(ALL) bean: any) {
await this.checkOwner(this.service,bean.id,"write");
await this.checkOwner(this.service, bean.id, "write");
await this.service.disabledChange({
id: bean.id,
disabled: bean.disabled
disabled: bean.disabled,
});
return this.ok();
}
@Post("/setting/get", { description: Constants.per.authOnly, summary: "获取站点监控设置" })
async get() {
const { userId, projectId } = await this.getProjectUserIdRead()
const setting = await this.service.getSetting(userId, projectId)
const { userId, projectId } = await this.getProjectUserIdRead();
const setting = await this.service.getSetting(userId, projectId);
return this.ok(setting);
}
@Post("/setting/save", { description: Constants.per.authOnly, summary: "保存站点监控设置" })
async save(@Body(ALL) bean: any) {
const { userId, projectId} = await this.getProjectUserIdWrite()
const { userId, projectId } = await this.getProjectUserIdWrite();
const setting = new UserSiteMonitorSetting();
merge(setting, bean);
await this.service.saveSetting(userId, projectId,setting);
await this.service.saveSetting(userId, projectId, setting);
return this.ok({});
}
}
@@ -8,8 +8,8 @@ import { ApiTags } from "@midwayjs/swagger";
/**
*/
@Provide()
@Controller('/api/monitor/site/ip')
@ApiTags(['monitor'])
@Controller("/api/monitor/site/ip")
@ApiTags(["monitor"])
export class SiteInfoController extends CrudController<SiteIpService> {
@Inject()
service: SiteIpService;
@@ -22,12 +22,12 @@ export class SiteInfoController extends CrudController<SiteIpService> {
return this.service;
}
@Post('/page', { description: Constants.per.authOnly, summary: "查询站点IP分页列表" })
@Post("/page", { description: Constants.per.authOnly, summary: "查询站点IP分页列表" })
async page(@Body(ALL) body: any) {
const { projectId, userId } = await this.getProjectUserIdRead()
const { projectId, userId } = await this.getProjectUserIdRead();
body.query = body.query ?? {};
body.query.userId = userId;
body.query.projectId = projectId
body.query.projectId = projectId;
const res = await this.service.page({
query: body.query,
page: body.page,
@@ -36,98 +36,94 @@ export class SiteInfoController extends CrudController<SiteIpService> {
return this.ok(res);
}
@Post('/list', { description: Constants.per.authOnly, summary: "查询站点IP列表" })
@Post("/list", { description: Constants.per.authOnly, summary: "查询站点IP列表" })
async list(@Body(ALL) body: any) {
body.query = body.query ?? {};
const { projectId, userId } = await this.getProjectUserIdRead()
const { projectId, userId } = await this.getProjectUserIdRead();
body.query.userId = userId;
body.query.projectId = projectId
body.query.projectId = projectId;
return await super.list(body);
}
@Post('/add', { description: Constants.per.authOnly, summary: "添加站点IP" })
@Post("/add", { description: Constants.per.authOnly, summary: "添加站点IP" })
async add(@Body(ALL) bean: any) {
const { projectId, userId } = await this.getProjectUserIdWrite()
const { projectId, userId } = await this.getProjectUserIdWrite();
bean.userId = userId;
bean.projectId = projectId
bean.from = "manual"
bean.projectId = projectId;
bean.from = "manual";
const res = await this.service.add(bean);
const siteEntity = await this.siteInfoService.info(bean.siteId);
if(!siteEntity.disabled){
const {domain, httpsPort} = siteEntity;
this.service.check(res.id,domain, httpsPort);
if (!siteEntity.disabled) {
const { domain, httpsPort } = siteEntity;
this.service.check(res.id, domain, httpsPort);
}
return this.ok(res);
}
@Post('/update', { description: Constants.per.authOnly, summary: "更新站点IP" })
@Post("/update", { description: Constants.per.authOnly, summary: "更新站点IP" })
async update(@Body(ALL) bean) {
await this.checkOwner(this.service,bean.id,"write");
await this.checkOwner(this.service, bean.id, "write");
delete bean.userId;
delete bean.projectId;
await this.service.update(bean);
const siteEntity = await this.siteInfoService.info(bean.siteId);
if(!siteEntity.disabled){
const {domain, httpsPort} = siteEntity;
this.service.check(siteEntity.id,domain, httpsPort);
if (!siteEntity.disabled) {
const { domain, httpsPort } = siteEntity;
this.service.check(siteEntity.id, domain, httpsPort);
}
return this.ok();
}
@Post('/info', { description: Constants.per.authOnly, summary: "查询站点IP详情" })
async info(@Query('id') id: number) {
await this.checkOwner(this.service,id,"read");
@Post("/info", { description: Constants.per.authOnly, summary: "查询站点IP详情" })
async info(@Query("id") id: number) {
await this.checkOwner(this.service, id, "read");
return await super.info(id);
}
@Post('/delete', { description: Constants.per.authOnly, summary: "删除站点IP" })
async delete(@Query('id') id: number) {
await this.checkOwner(this.service,id,"write");
@Post("/delete", { description: Constants.per.authOnly, summary: "删除站点IP" })
async delete(@Query("id") id: number) {
await this.checkOwner(this.service, id, "write");
const entity = await this.service.info(id);
const res = await super.delete(id);
await this.service.updateIpCount(entity.siteId)
return res
await this.service.updateIpCount(entity.siteId);
return res;
}
@Post('/check', { description: Constants.per.authOnly, summary: "检查站点IP" })
async check(@Body('id') id: number) {
await this.checkOwner(this.service,id,"read");
@Post("/check", { description: Constants.per.authOnly, summary: "检查站点IP" })
async check(@Body("id") id: number) {
await this.checkOwner(this.service, id, "read");
const entity = await this.service.info(id);
const siteEntity = await this.siteInfoService.info(entity.siteId);
const domain = siteEntity.domain;
const port = siteEntity.httpsPort;
this.service.check(id,domain,port);
this.service.check(id, domain, port);
return this.ok();
}
@Post('/checkAll', { description: Constants.per.authOnly, summary: "检查所有站点IP" })
async checkAll(@Body('siteId') siteId: number) {
await this.getProjectUserIdRead()
@Post("/checkAll", { description: Constants.per.authOnly, summary: "检查所有站点IP" })
async checkAll(@Body("siteId") siteId: number) {
await this.getProjectUserIdRead();
const siteEntity = await this.siteInfoService.info(siteId);
await this.service.syncAndCheck(siteEntity);
return this.ok();
}
@Post('/sync', { description: Constants.per.authOnly, summary: "同步站点IP" })
async sync(@Body('siteId') siteId: number) {
await this.getProjectUserIdWrite()
const entity = await this.siteInfoService.info(siteId)
@Post("/sync", { description: Constants.per.authOnly, summary: "同步站点IP" })
async sync(@Body("siteId") siteId: number) {
await this.getProjectUserIdWrite();
const entity = await this.siteInfoService.info(siteId);
await this.service.sync(entity);
return this.ok();
}
@Post('/import', { description: Constants.per.authOnly, summary: "导入站点IP" })
@Post("/import", { description: Constants.per.authOnly, summary: "导入站点IP" })
async doImport(@Body(ALL) body: any) {
const { userId, projectId } = await this.getProjectUserIdWrite()
const { userId, projectId } = await this.getProjectUserIdWrite();
await this.service.doImport({
text:body.text,
text: body.text,
userId,
siteId:body.siteId,
projectId
})
siteId: body.siteId,
projectId,
});
return this.ok();
}
}