From 63305e73166c805c342437700252d55c541126a8 Mon Sep 17 00:00:00 2001 From: zhengkunwang <31820853+zhengkunwang223@users.noreply.github.com> Date: Fri, 7 Jun 2024 11:02:03 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E8=87=AA=E7=AD=BE?= =?UTF-8?q?=E8=AF=81=E4=B9=A6=E5=BC=80=E5=90=AF=E8=87=AA=E5=8A=A8=E7=BB=AD?= =?UTF-8?q?=E7=AD=BE=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98=20(#5335?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/dto/request/website_ssl.go | 2 +- backend/app/service/website_ssl.go | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/backend/app/dto/request/website_ssl.go b/backend/app/dto/request/website_ssl.go index 726512c13..556b6c1a4 100644 --- a/backend/app/dto/request/website_ssl.go +++ b/backend/app/dto/request/website_ssl.go @@ -77,7 +77,7 @@ type WebsiteSSLUpdate struct { PrimaryDomain string `json:"primaryDomain" validate:"required"` OtherDomains string `json:"otherDomains"` Provider string `json:"provider" validate:"required"` - AcmeAccountID uint `json:"acmeAccountId" validate:"required"` + AcmeAccountID uint `json:"acmeAccountId"` DnsAccountID uint `json:"dnsAccountId"` KeyType string `json:"keyType"` Apply bool `json:"apply"` diff --git a/backend/app/service/website_ssl.go b/backend/app/service/website_ssl.go index 43be40b22..d2d000b4f 100644 --- a/backend/app/service/website_ssl.go +++ b/backend/app/service/website_ssl.go @@ -389,11 +389,13 @@ func (w WebsiteSSLService) Update(update request.WebsiteSSLUpdate) error { updateParams["nameserver1"] = update.Nameserver1 updateParams["nameserver2"] = update.Nameserver2 - acmeAccount, err := websiteAcmeRepo.GetFirst(commonRepo.WithByID(update.AcmeAccountID)) - if err != nil { - return err + if websiteSSL.Provider != constant.SelfSigned { + acmeAccount, err := websiteAcmeRepo.GetFirst(commonRepo.WithByID(update.AcmeAccountID)) + if err != nil { + return err + } + updateParams["acme_account_id"] = acmeAccount.ID } - updateParams["acme_account_id"] = acmeAccount.ID if update.PushDir { if !files.NewFileOp().Stat(update.Dir) { @@ -412,7 +414,7 @@ func (w WebsiteSSLService) Update(update request.WebsiteSSLUpdate) error { } } updateParams["domains"] = strings.Join(domains, ",") - if update.Provider == constant.DNSAccount || update.Provider == constant.Http { + if update.Provider == constant.DNSAccount || update.Provider == constant.Http || update.Provider == constant.SelfSigned { updateParams["auto_renew"] = update.AutoRenew } else { updateParams["auto_renew"] = false