From fe8601f753ff427acdac7d2ed5a662ba04c2169f Mon Sep 17 00:00:00 2001 From: zhengkunwang223 Date: Thu, 22 Dec 2022 10:30:32 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9acme=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=8E=A5=E5=8F=A3=E4=B8=BApost?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/api/v1/website_acme_account.go | 7 +++---- backend/app/dto/request/website_ssl.go | 4 ++++ backend/router/ro_website_acme_account.go | 2 +- frontend/src/api/interface/website.ts | 4 ++++ frontend/src/api/modules/website.ts | 4 ++-- frontend/src/views/website/ssl/acme-account/index.vue | 2 +- 6 files changed, 15 insertions(+), 8 deletions(-) diff --git a/backend/app/api/v1/website_acme_account.go b/backend/app/api/v1/website_acme_account.go index 8dfd66c95..0212da25b 100644 --- a/backend/app/api/v1/website_acme_account.go +++ b/backend/app/api/v1/website_acme_account.go @@ -40,13 +40,12 @@ func (b *BaseApi) CreateWebsiteAcmeAccount(c *gin.Context) { } func (b *BaseApi) DeleteWebsiteAcmeAccount(c *gin.Context) { - id, err := helper.GetParamID(c) - if err != nil { + var req request.WebsiteResourceReq + if err := c.ShouldBindJSON(&req); err != nil { helper.ErrorWithDetail(c, constant.CodeErrBadRequest, constant.ErrTypeInvalidParams, err) return } - - if err := websiteAcmeAccountService.Delete(id); err != nil { + if err := websiteAcmeAccountService.Delete(req.ID); err != nil { helper.ErrorWithDetail(c, constant.CodeErrInternalServer, constant.ErrTypeInternalServer, err) return } diff --git a/backend/app/dto/request/website_ssl.go b/backend/app/dto/request/website_ssl.go index ff3abb611..bcb8b4a28 100644 --- a/backend/app/dto/request/website_ssl.go +++ b/backend/app/dto/request/website_ssl.go @@ -39,3 +39,7 @@ type WebsiteDnsAccountUpdate struct { Type string `json:"type" validate:"required"` Authorization map[string]string `json:"authorization" validate:"required"` } + +type WebsiteResourceReq struct { + ID uint `json:"id" validate:"required"` +} diff --git a/backend/router/ro_website_acme_account.go b/backend/router/ro_website_acme_account.go index 540482b22..3d36e519b 100644 --- a/backend/router/ro_website_acme_account.go +++ b/backend/router/ro_website_acme_account.go @@ -17,6 +17,6 @@ func (a *WebsiteAcmeAccountRouter) InitWebsiteAcmeAccountRouter(Router *gin.Rout { groupRouter.POST("/search", baseApi.PageWebsiteAcmeAccount) groupRouter.POST("", baseApi.CreateWebsiteAcmeAccount) - groupRouter.DELETE("/:id", baseApi.DeleteWebsiteAcmeAccount) + groupRouter.POST("/del", baseApi.DeleteWebsiteAcmeAccount) } } diff --git a/frontend/src/api/interface/website.ts b/frontend/src/api/interface/website.ts index 486339e90..4bd3a3219 100644 --- a/frontend/src/api/interface/website.ts +++ b/frontend/src/api/interface/website.ts @@ -228,4 +228,8 @@ export namespace Website { websiteId: number; key: string; } + + export interface DelReq { + id: number; + } } diff --git a/frontend/src/api/modules/website.ts b/frontend/src/api/modules/website.ts index 224783c60..b6f70b387 100644 --- a/frontend/src/api/modules/website.ts +++ b/frontend/src/api/modules/website.ts @@ -103,8 +103,8 @@ export const CreateAcmeAccount = (req: Website.AcmeAccountCreate) => { return http.post(`/websites/acme`, req); }; -export const DeleteAcmeAccount = (id: number) => { - return http.delete(`/websites/acme/${id}`); +export const DeleteAcmeAccount = (req: Website.DelReq) => { + return http.post(`/websites/acme/del`, req); }; export const SearchSSL = (req: ReqPage) => { diff --git a/frontend/src/views/website/ssl/acme-account/index.vue b/frontend/src/views/website/ssl/acme-account/index.vue index 93465f657..d8f5a5b81 100644 --- a/frontend/src/views/website/ssl/acme-account/index.vue +++ b/frontend/src/views/website/ssl/acme-account/index.vue @@ -71,7 +71,7 @@ const openCreate = () => { }; const deleteAccount = async (id: number) => { - await useDeleteData(DeleteAcmeAccount, id, 'commons.msg.delete'); + await useDeleteData(DeleteAcmeAccount, { id: id }, 'commons.msg.delete'); search(); };