feat 错误码

This commit is contained in:
2026-01-14 14:21:41 +08:00
parent 6aefdaf650
commit 1c90e21050
4 changed files with 14 additions and 14 deletions

View File

@@ -35,13 +35,13 @@ func JsonBadRequest(c *gin.Context) {
}
func JsonMethodNotAllowed(c *gin.Context) {
c.JSON(http.StatusMethodNotAllowed, Error(NewCode(Failed.Code(), "Method Not Allowed")))
c.JSON(http.StatusMethodNotAllowed, Error(MethodNotAllowed))
}
func JsonNotFound(c *gin.Context) {
c.JSON(http.StatusNotFound, Error(NewCode(Failed.Code(), "Endpoint Not Found")))
c.JSON(http.StatusNotFound, Error(NotFound))
}
func AbortUnauthorized(c *gin.Context) {
c.AbortWithStatusJSON(http.StatusUnauthorized, Error(NewCode(Failed.Code(), "Invalid Authorization")))
func JsonUnauthorized(c *gin.Context) {
c.JSON(http.StatusUnauthorized, Error(TokenInvalid))
}