perf: cname记录支持批量导入和导出

This commit is contained in:
xiaojunnuo
2026-01-22 10:56:45 +08:00
parent a97cee84f3
commit 607afe864a
10 changed files with 166 additions and 9 deletions
@@ -1,6 +1,7 @@
import { ALL, Body, Controller, Inject, Post, Provide, Query } from '@midwayjs/core';
import { Constants, CrudController } from '@certd/lib-server';
import {DomainService} from "../../../modules/cert/service/domain-service.js";
import { checkPlus } from '@certd/plus-core';
/**
* 授权
@@ -79,12 +80,13 @@ export class DomainController extends CrudController<DomainService> {
}
@Post('/sync/submit', { summary: Constants.per.authOnly })
async syncSubmit(@Body(ALL) body: any) {
@Post('/sync/import', { summary: Constants.per.authOnly })
async syncImport(@Body(ALL) body: any) {
const { dnsProviderType, dnsProviderAccessId } = body;
const req = {
dnsProviderType, dnsProviderAccessId, userId: this.getUserId(),
}
checkPlus()
await this.service.doSyncFromProvider(req);
return this.ok();
}
@@ -99,4 +99,15 @@ export class CnameRecordController extends CrudController<CnameRecordService> {
const res = await this.service.resetStatus(body.id);
return this.ok(res);
}
@Post('/import', { summary: Constants.per.authOnly })
async import(@Body(ALL) body: { domainList: string; cnameProviderId: any }) {
const userId = this.getUserId();
const res = await this.service.doImport({
userId,
domainList: body.domainList,
cnameProviderId: body.cnameProviderId,
});
return this.ok(res);
}
}