From 16967c4ab1d96e04b8816b1d72c932eae4a0f27b Mon Sep 17 00:00:00 2001 From: yoan <536464346@qq.com> Date: Wed, 30 Oct 2024 09:31:51 +0800 Subject: [PATCH] fix tencent cdn deploy --- internal/deployer/tencent_cdn.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/deployer/tencent_cdn.go b/internal/deployer/tencent_cdn.go index 26c9c252..566d5b9b 100644 --- a/internal/deployer/tencent_cdn.go +++ b/internal/deployer/tencent_cdn.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" "strings" + "golang.org/x/exp/slices" cdn "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cdn/v20180606" @@ -111,10 +112,10 @@ func (d *TencentCDNDeployer) deploy(certId string) error { request.InstanceIdList = common.StringPtrs(list) } else { // 否则直接使用传入的域名 deployed, _ := d.isDomainDeployed(certId, domain) - if(deployed){ + if deployed { d.infos = append(d.infos, "域名已部署") return nil - }else{ + } else { request.InstanceIdList = common.StringPtrs([]string{domain}) } } @@ -150,7 +151,7 @@ func (d *TencentCDNDeployer) getDomainList(certId string) ([]string, error) { domains := make([]string, 0) for _, domain := range response.Response.Domains { domainStr := *domain - if(slices.Contains(deployedDomains, domainStr)){ + if !slices.Contains(deployedDomains, domainStr) { domains = append(domains, domainStr) } } @@ -160,7 +161,7 @@ func (d *TencentCDNDeployer) getDomainList(certId string) ([]string, error) { func (d *TencentCDNDeployer) isDomainDeployed(certId, domain string) (bool, error) { deployedDomains, err := d.getDeployedDomainList(certId) - if(err != nil){ + if err != nil { return false, err }