From 2902ee6ad5c11e0991a305b3930b4d97ba7462de Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Sat, 27 Sep 2025 01:35:39 +0800 Subject: [PATCH] chore: sql --- .../cname/service/cname-record-service.ts | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/packages/ui/certd-server/src/modules/cname/service/cname-record-service.ts b/packages/ui/certd-server/src/modules/cname/service/cname-record-service.ts index c85d5937..47ae605a 100644 --- a/packages/ui/certd-server/src/modules/cname/service/cname-record-service.ts +++ b/packages/ui/certd-server/src/modules/cname/service/cname-record-service.ts @@ -193,17 +193,7 @@ export class CnameRecordService extends BaseService { } } - if (!record.mainDomain){ - let domainPrefix = record.hostRecord.replace("_acme-challenge", ""); - if (domainPrefix.startsWith(".")) { - domainPrefix = domainPrefix.substring(1); - } - record.mainDomain = record.domain.replace(domainPrefix, ""); - await this.update({ - id: record.id, - mainDomain: record.mainDomain, - }) - } + await this.fillMainDomain(record); const provider = await this.cnameProviderService.info(record.cnameProviderId); if (provider == null) { @@ -218,6 +208,20 @@ export class CnameRecordService extends BaseService { } as CnameRecord; } + private async fillMainDomain(record: CnameRecordEntity) { + if (!record.mainDomain) { + let domainPrefix = record.hostRecord.replace("_acme-challenge", ""); + if (domainPrefix.startsWith(".")) { + domainPrefix = domainPrefix.substring(1); + } + record.mainDomain = record.domain.replace(domainPrefix+".", ""); + await this.update({ + id: record.id, + mainDomain: record.mainDomain + }); + } + } + /** * 验证是否配置好cname * @param id