mirror of
https://github.com/certd/certd.git
synced 2026-04-23 11:37:23 +08:00
perf: cname记录支持批量导入和导出
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user