From 7f71b5f262d081a1e8294362612d73f01b582028 Mon Sep 17 00:00:00 2001 From: zhengkunwang223 Date: Wed, 4 Jan 2023 14:26:22 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=BB=AD=E7=AD=BE=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E5=BA=94=E7=94=A8=E5=88=B0=E7=BD=91=E7=AB=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/model/website_dns_account.go | 2 +- backend/app/model/website_ssl.go | 1 + backend/app/repo/website_ssl.go | 2 +- frontend/src/api/interface/website.ts | 1 + frontend/src/lang/modules/zh.ts | 1 + frontend/src/views/website/ssl/index.vue | 6 ++--- .../src/views/website/ssl/renew/index.vue | 23 ++++++++++++++++--- 7 files changed, 28 insertions(+), 8 deletions(-) diff --git a/backend/app/model/website_dns_account.go b/backend/app/model/website_dns_account.go index a4ae1bdac..de7ae8dee 100644 --- a/backend/app/model/website_dns_account.go +++ b/backend/app/model/website_dns_account.go @@ -4,7 +4,7 @@ type WebsiteDnsAccount struct { BaseModel Name string `gorm:"type:varchar(64);not null" json:"name"` Type string `gorm:"type:varchar(64);not null" json:"type"` - Authorization string `gorm:"type:varchar(256);not null" json:"_"` + Authorization string `gorm:"type:varchar(256);not null" json:"-"` } func (w WebsiteDnsAccount) TableName() string { diff --git a/backend/app/model/website_ssl.go b/backend/app/model/website_ssl.go index 0d13048da..f880ac2bd 100644 --- a/backend/app/model/website_ssl.go +++ b/backend/app/model/website_ssl.go @@ -19,6 +19,7 @@ type WebsiteSSL struct { StartDate time.Time `json:"startDate"` AcmeAccount WebsiteAcmeAccount `json:"acmeAccount"` + Websites []Website `json:"websites"` } func (w WebsiteSSL) TableName() string { diff --git a/backend/app/repo/website_ssl.go b/backend/app/repo/website_ssl.go index 7e7457cca..4b49d6cc7 100644 --- a/backend/app/repo/website_ssl.go +++ b/backend/app/repo/website_ssl.go @@ -48,7 +48,7 @@ func (w WebsiteSSLRepo) Page(page, size int, opts ...DBOption) (int64, []model.W db := getDb(opts...).Model(&model.WebsiteSSL{}) count := int64(0) db = db.Count(&count) - err := db.Limit(size).Offset(size * (page - 1)).Preload("AcmeAccount").Find(&sslList).Error + err := db.Limit(size).Offset(size * (page - 1)).Preload("AcmeAccount").Preload("Websites").Find(&sslList).Error return count, sslList, err } diff --git a/frontend/src/api/interface/website.ts b/frontend/src/api/interface/website.ts index 57099181c..92b75595d 100644 --- a/frontend/src/api/interface/website.ts +++ b/frontend/src/api/interface/website.ts @@ -169,6 +169,7 @@ export namespace Website { expireDate: string; startDate: string; provider: string; + websites?: Website.Website[]; } export interface SSLCreate { diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index 88a9c1316..9f2281547 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -1002,6 +1002,7 @@ export default { autoRenew: '自动续签', autoRenewHelper: '距离到期时间7天自动续签', renewSuccess: '续签成功', + renewWebsite: '该证书已经和以下网站关联,续签会同步应用到这些网站', }, firewall: { ccDeny: 'CC 防护', diff --git a/frontend/src/views/website/ssl/index.vue b/frontend/src/views/website/ssl/index.vue index 2c02170e3..bc17dd5ba 100644 --- a/frontend/src/views/website/ssl/index.vue +++ b/frontend/src/views/website/ssl/index.vue @@ -105,7 +105,7 @@ const buttons = [ return row.provider === 'manual'; }, click: function (row: Website.SSL) { - openRenewSSL(row.id); + openRenewSSL(row.id, row.websites); }, }, { @@ -141,8 +141,8 @@ const openDnsAccount = () => { const openSSL = () => { sslCreateRef.value.acceptParams(); }; -const openRenewSSL = (id: number) => { - renewRef.value.acceptParams(id); +const openRenewSSL = (id: number, websites: Website.Website[]) => { + renewRef.value.acceptParams({ id: id, websites: websites }); }; const openDetail = (id: number) => { detailRef.value.acceptParams(id); diff --git a/frontend/src/views/website/ssl/renew/index.vue b/frontend/src/views/website/ssl/renew/index.vue index 9a6c4c0ab..8772c2d5d 100644 --- a/frontend/src/views/website/ssl/renew/index.vue +++ b/frontend/src/views/website/ssl/renew/index.vue @@ -8,6 +8,16 @@ :before-close="handleClose" >
+ {{ $t('ssl.renewWebsite') }} +
+
+ + + {{ website.primaryDomain }} + + +
+
{{ $t('ssl.renewConfirm') }}