fix: 统一业务响应状态码约定

This commit is contained in:
2026-08-09 01:16:53 +08:00
parent 20e92dc82f
commit 66bc98ca8a
7 changed files with 106 additions and 92 deletions
+1 -1
View File
@@ -136,7 +136,7 @@ func BearerToken(header string) (string, error) {
func abortUnauthorized(c *gin.Context, message string) {
Logger.Warn("JWT认证失败", zap.String("message", message), zap.String("path", c.Request.URL.Path))
c.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{"code": 401, "message": message, "data": nil})
c.AbortWithStatusJSON(http.StatusOK, gin.H{"code": 401, "message": message, "data": nil})
}
func GetCurrentUser(c *gin.Context) (int, string, bool) {