From fd185bcfe1e37f0c086f05b79091a14ed2a8cab2 Mon Sep 17 00:00:00 2001 From: shanshanzhong Date: Mon, 22 Dec 2025 20:32:12 -0800 Subject: [PATCH] =?UTF-8?q?refactor(handler):=20=E4=BD=BF=E7=94=A8result?= =?UTF-8?q?=E5=8C=85=E7=BB=9F=E4=B8=80=E5=A4=84=E7=90=86HTTP=E5=93=8D?= =?UTF-8?q?=E5=BA=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在deleteAccountHandler中使用result.HttpResult统一处理HTTP响应,提高代码一致性和可维护性 --- internal/handler/public/user/deleteAccountHandler.go | 4 +++- internal/logic/public/user/deleteAccountLogic.go | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/handler/public/user/deleteAccountHandler.go b/internal/handler/public/user/deleteAccountHandler.go index 63f9ab7..ca74212 100644 --- a/internal/handler/public/user/deleteAccountHandler.go +++ b/internal/handler/public/user/deleteAccountHandler.go @@ -7,6 +7,7 @@ import ( "github.com/gin-gonic/gin" "github.com/perfect-panel/server/internal/logic/public/user" "github.com/perfect-panel/server/internal/svc" + "github.com/perfect-panel/server/pkg/result" ) // DeleteAccountHandler 注销账号处理器 @@ -37,7 +38,8 @@ func DeleteAccountHandler(serverCtx *svc.ServiceContext) gin.HandlerFunc { c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) return } - c.JSON(http.StatusOK, resp) + result.HttpResult(c, resp, err) + } } diff --git a/internal/logic/public/user/deleteAccountLogic.go b/internal/logic/public/user/deleteAccountLogic.go index 5146276..6d7d080 100644 --- a/internal/logic/public/user/deleteAccountLogic.go +++ b/internal/logic/public/user/deleteAccountLogic.go @@ -109,6 +109,7 @@ func (l *DeleteAccountLogic) DeleteAccount() (resp *types.DeleteAccountResponse, resp.Message = "账户注销成功" resp.UserId = newUserId resp.Code = 200 + return resp, nil }