refactor(handler): 使用result包统一处理HTTP响应
Build docker and publish / build (20.15.1) (push) Successful in 5m57s
Build docker and publish / build (20.15.1) (push) Successful in 5m57s
在deleteAccountHandler中使用result.HttpResult统一处理HTTP响应,提高代码一致性和可维护性
This commit is contained in:
@@ -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)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user