From 1ccc56100c3077936fd4db117a22410275590133 Mon Sep 17 00:00:00 2001 From: zhengkunwang <31820853+zhengkunwang223@users.noreply.github.com> Date: Thu, 13 Jul 2023 14:17:18 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E9=9D=A2=E6=9D=BF?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E6=97=A0=E6=B3=95=E9=80=89=E6=8B=A9=20https?= =?UTF-8?q?=20=E8=AF=81=E4=B9=A6=E7=9A=84=E9=97=AE=E9=A2=98=20(#1638)?= 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 | 10 +++++++++- cmd/server/docs/docs.go | 18 ++++++++++++------ cmd/server/docs/swagger.json | 14 ++++++++++---- cmd/server/docs/swagger.yaml | 12 ++++++++---- frontend/src/api/interface/website.ts | 2 +- .../website/config/basic/https/index.vue | 5 ++--- 7 files changed, 43 insertions(+), 20 deletions(-) diff --git a/backend/app/dto/request/website_ssl.go b/backend/app/dto/request/website_ssl.go index 10da74394..13868f3c8 100644 --- a/backend/app/dto/request/website_ssl.go +++ b/backend/app/dto/request/website_ssl.go @@ -4,7 +4,7 @@ import "github.com/1Panel-dev/1Panel/backend/app/dto" type WebsiteSSLSearch struct { dto.PageInfo - AcmeAccountID uint `json:"acmeAccountId"` + AcmeAccountID string `json:"acmeAccountID"` } type WebsiteSSLCreate struct { diff --git a/backend/app/service/website_ssl.go b/backend/app/service/website_ssl.go index f709d278c..0260896f3 100644 --- a/backend/app/service/website_ssl.go +++ b/backend/app/service/website_ssl.go @@ -13,6 +13,7 @@ import ( "github.com/1Panel-dev/1Panel/backend/global" "github.com/1Panel-dev/1Panel/backend/utils/ssl" "path" + "strconv" "strings" ) @@ -66,7 +67,14 @@ func (w WebsiteSSLService) Search(search request.WebsiteSSLSearch) ([]response.W opts []repo.DBOption result []response.WebsiteSSLDTO ) - opts = append(opts, commonRepo.WithOrderBy("created_at desc"), websiteSSLRepo.WithByAcmeAccountId(search.AcmeAccountID)) + opts = append(opts, commonRepo.WithOrderBy("created_at desc")) + if search.AcmeAccountID != "" { + acmeAccountID, err := strconv.ParseUint(search.AcmeAccountID, 10, 64) + if err != nil { + return nil, err + } + opts = append(opts, websiteSSLRepo.WithByAcmeAccountId(uint(acmeAccountID))) + } sslList, err := websiteSSLRepo.List(opts...) if err != nil { return nil, err diff --git a/cmd/server/docs/docs.go b/cmd/server/docs/docs.go index 0399621dd..a1898dab1 100644 --- a/cmd/server/docs/docs.go +++ b/cmd/server/docs/docs.go @@ -1,5 +1,5 @@ -// Code generated by swaggo/swag. DO NOT EDIT. - +// Package docs GENERATED BY SWAG; DO NOT EDIT +// This file was generated by swaggo/swag package docs import "github.com/swaggo/swag" @@ -11068,6 +11068,9 @@ const docTemplate = `{ "$ref": "#/definitions/dto.PortHelper" } }, + "forcePull": { + "type": "boolean" + }, "image": { "type": "string" }, @@ -11078,13 +11081,13 @@ const docTemplate = `{ } }, "memory": { - "type": "integer" + "type": "number" }, "name": { "type": "string" }, "nanoCPUs": { - "type": "integer" + "type": "number" }, "network": { "type": "string" @@ -11198,6 +11201,9 @@ const docTemplate = `{ "name" ], "properties": { + "forcePull": { + "type": "boolean" + }, "image": { "type": "string" }, @@ -15159,8 +15165,8 @@ const docTemplate = `{ "pageSize" ], "properties": { - "acmeAccountId": { - "type": "integer" + "acmeAccountID": { + "type": "string" }, "page": { "type": "integer" diff --git a/cmd/server/docs/swagger.json b/cmd/server/docs/swagger.json index f54021896..0f7822bea 100644 --- a/cmd/server/docs/swagger.json +++ b/cmd/server/docs/swagger.json @@ -11061,6 +11061,9 @@ "$ref": "#/definitions/dto.PortHelper" } }, + "forcePull": { + "type": "boolean" + }, "image": { "type": "string" }, @@ -11071,13 +11074,13 @@ } }, "memory": { - "type": "integer" + "type": "number" }, "name": { "type": "string" }, "nanoCPUs": { - "type": "integer" + "type": "number" }, "network": { "type": "string" @@ -11191,6 +11194,9 @@ "name" ], "properties": { + "forcePull": { + "type": "boolean" + }, "image": { "type": "string" }, @@ -15152,8 +15158,8 @@ "pageSize" ], "properties": { - "acmeAccountId": { - "type": "integer" + "acmeAccountID": { + "type": "string" }, "page": { "type": "integer" diff --git a/cmd/server/docs/swagger.yaml b/cmd/server/docs/swagger.yaml index a433e4863..02772bd22 100644 --- a/cmd/server/docs/swagger.yaml +++ b/cmd/server/docs/swagger.yaml @@ -327,6 +327,8 @@ definitions: items: $ref: '#/definitions/dto.PortHelper' type: array + forcePull: + type: boolean image: type: string labels: @@ -334,11 +336,11 @@ definitions: type: string type: array memory: - type: integer + type: number name: type: string nanoCPUs: - type: integer + type: number network: type: string publishAllPorts: @@ -413,6 +415,8 @@ definitions: type: object dto.ContainerUpgrade: properties: + forcePull: + type: boolean image: type: string name: @@ -3063,8 +3067,8 @@ definitions: type: object request.WebsiteSSLSearch: properties: - acmeAccountId: - type: integer + acmeAccountID: + type: string page: type: integer pageSize: diff --git a/frontend/src/api/interface/website.ts b/frontend/src/api/interface/website.ts index cd5e58278..ad5bbed30 100644 --- a/frontend/src/api/interface/website.ts +++ b/frontend/src/api/interface/website.ts @@ -208,7 +208,7 @@ export namespace Website { export interface SSLReq { name?: string; - acmeAccountID?: number; + acmeAccountID?: string; } export interface HTTPSReq { diff --git a/frontend/src/views/website/website/config/basic/https/index.vue b/frontend/src/views/website/website/config/basic/https/index.vue index 7487f7602..eb57ab2d6 100644 --- a/frontend/src/views/website/website/config/basic/https/index.vue +++ b/frontend/src/views/website/website/config/basic/https/index.vue @@ -207,7 +207,7 @@ const rules = ref({ }); const resData = ref(); const sslReq = reactive({ - acmeAccountID: 0, + acmeAccountID: '', }); const getPrivateKeyPath = (path: string) => { @@ -218,7 +218,7 @@ const getCertificatePath = (path: string) => { form.certificatePath = path; }; const listSSL = () => { - sslReq.acmeAccountID = form.acmeAccountID; + sslReq.acmeAccountID = String(form.acmeAccountID); ListSSL(sslReq).then((res) => { ssls.value = res.data || []; if (ssls.value.length > 0) { @@ -278,7 +278,6 @@ const get = () => { if (res.data.SSL && res.data.SSL.id > 0) { form.websiteSSLId = res.data.SSL.id; websiteSSL.value = res.data.SSL; - sslReq.acmeAccountID = res.data.SSL.acmeAccountId; form.acmeAccountID = res.data.SSL.acmeAccountId; } }