From 02dabe11db3e9b13ca4621ce9ddd2b808bfca390 Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Thu, 9 Jul 2026 16:39:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=81=AB=E5=B1=B1?= =?UTF-8?q?=E5=BC=95=E6=93=8E=E6=9F=A5=E4=B8=8D=E5=88=B0=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E6=BA=90=E7=AB=99=E5=9F=9F=E5=90=8D=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/user/mine/mine-controller.ts | 6 +- .../src/plugins/plugin-asiaisp/client.ts | 8 +-- .../plugins/plugin-deploy-to-vod.ts | 66 +++++++++++-------- 3 files changed, 45 insertions(+), 35 deletions(-) diff --git a/packages/ui/certd-server/src/controller/user/mine/mine-controller.ts b/packages/ui/certd-server/src/controller/user/mine/mine-controller.ts index 8c4b7ea5d..1faefb321 100644 --- a/packages/ui/certd-server/src/controller/user/mine/mine-controller.ts +++ b/packages/ui/certd-server/src/controller/user/mine/mine-controller.ts @@ -65,7 +65,7 @@ export class MineController extends BaseController { user.needInitAccount = true; } } - + return this.ok(user); } @@ -150,7 +150,7 @@ export class MineController extends BaseController { @Post("/accountInit", { description: Constants.per.authOnly, summary: "初始化Let's Encrypt ACME账号和邮件通知" }) public async accountInit(@Body("email") email?: string) { - let userId = this.getUserId(); + const userId = this.getUserId(); let userEmail = email; let user: any = null; if (!userEmail) { @@ -190,7 +190,7 @@ export class MineController extends BaseController { type: "acmeAccount", name: "Let's Encrypt", userId, - projectId:undefined, + projectId: undefined, setting: JSON.stringify({ caType: "letsencrypt", email: userEmail, diff --git a/packages/ui/certd-server/src/plugins/plugin-asiaisp/client.ts b/packages/ui/certd-server/src/plugins/plugin-asiaisp/client.ts index b5006ff95..43c1c8f26 100644 --- a/packages/ui/certd-server/src/plugins/plugin-asiaisp/client.ts +++ b/packages/ui/certd-server/src/plugins/plugin-asiaisp/client.ts @@ -114,7 +114,7 @@ export class AsiaIspClient { if (response.code !== "0") { this.logger.error(`接口请求失败: code=${response.code}, msg=${response.msg}`); - const e= new Error(response.msg || "接口请求失败"); + const e = new Error(response.msg || "接口请求失败"); // @ts-ignore e.errorCode = response.code; throw e; @@ -122,9 +122,9 @@ export class AsiaIspClient { return response; } catch (error: any) { - const response = error.response + const response = error.response; if (response && response.data) { - const e = new Error(response.data.msg || error.message || "接口请求失败"); + const e = new Error(response.data.msg || error.message || "接口请求失败"); // @ts-ignore e.errorCode = response.data.code; throw e; @@ -245,7 +245,7 @@ export class AsiaIspClient { this.logger.info(`域名 ${req.domain} 已绑定该证书 ${req.certId},无需重复绑定`); return; } - throw e + throw e; } this.logger.info(`部署证书到域名成功: ${req.domain}, certId=${req.certId}`); } diff --git a/packages/ui/certd-server/src/plugins/plugin-volcengine/plugins/plugin-deploy-to-vod.ts b/packages/ui/certd-server/src/plugins/plugin-volcengine/plugins/plugin-deploy-to-vod.ts index e31eeeae6..3c668f7c5 100644 --- a/packages/ui/certd-server/src/plugins/plugin-volcengine/plugins/plugin-deploy-to-vod.ts +++ b/packages/ui/certd-server/src/plugins/plugin-volcengine/plugins/plugin-deploy-to-vod.ts @@ -86,8 +86,6 @@ export class VolcengineDeployToVOD extends AbstractTaskPlugin { }) domainType!: string; - - @TaskInput( createRemoteSelectInputDefine({ title: "域名", @@ -111,18 +109,24 @@ export class VolcengineDeployToVOD extends AbstractTaskPlugin { const access = await this.getAccess(this.accessId); const certId = await this.uploadOrGetCertId(access); - const service = await this.getVodService({ version: "2023-07-01", region: this.regionId }); + const domainTypeMapping: Record = { + play: "vod_play", + image: "vod_image", + }; + const apiDomainType = domainTypeMapping[this.domainType] || this.domainType; + + const service = await this.getVodService({ version: "2026-01-01", region: this.regionId }); const domains = Array.isArray(this.domainList) ? this.domainList : [this.domainList]; for (const domain of domains) { this.logger.info(`开始部署域名${domain}证书`); await service.request({ - action: "UpdateDomainConfig", + action: "UpdateVodDomainConfig", method: "POST", body: { SpaceName: this.spaceName, - DomainType: this.domainType, + DomainType: apiDomainType, Domain: domain, - Config: { + UpdateCdnConfigParam: { HTTPS: { Switch: true, CertInfo: { @@ -207,34 +211,40 @@ export class VolcengineDeployToVOD extends AbstractTaskPlugin { if (!this.spaceName) { throw new Error("请先选择空间名称"); } - const service = await this.getVodService({ version: "2023-01-01", region: this.regionId }); + const service = await this.getVodService({ version: "2026-01-01", region: this.regionId }); - const query: Record = { - SpaceName: this.spaceName, - DomainType: this.domainType, + const domainTypeMapping: Record = { + play: "vod_play", + image: "vod_image", }; + const apiDomainType = domainTypeMapping[this.domainType] || this.domainType; + + const body: Record = { + SpaceName: this.spaceName, + ListCdnDomainsParam: { + PageNum: 1, + PageSize: 100, + }, + }; + if (apiDomainType) { + body.DomainType = apiDomainType; + } const res = await service.request({ - action: "ListDomain", - query, + action: "ListVodDomains", + method: "POST", + body, }); - const instances = res.Result?.PlayInstanceInfo?.ByteInstances; - if (!instances || instances.length === 0) { - throw new Error("找不到域名,您也可以手动输入域名"); - } - const list = []; - for (const item of instances) { - if (item.Domains && item.Domains.length > 0) { - for (const domain of item.Domains) { - if (domain.Domain) { - list.push({ - value: domain.Domain, - label: domain.Domain, - }); - } - } - } + const domains = res.Result?.VodInfo?.Domains; + if (!domains || domains.length === 0) { + return []; } + const list = domains.map((item: any) => { + return { + value: item.Domain, + label: item.Domain, + }; + }); return this.ctx.utils.options.buildGroupOptions(list, this.certDomains); } }