feature:调整jwt令牌过期展现形式和返回错误编码形式,方便用户重新登录和知晓错误原因。

This commit is contained in:
pixelMax(奇淼
2024-03-27 17:35:03 +08:00
parent ad323a0dff
commit 3c2595aaf9
3 changed files with 28 additions and 9 deletions

View File

@@ -50,6 +50,14 @@ func FailWithMessage(message string, c *gin.Context) {
Result(ERROR, map[string]interface{}{}, message, c)
}
func NoAuth(message string, c *gin.Context) {
c.JSON(http.StatusUnauthorized, Response{
7,
nil,
message,
})
}
func FailWithDetailed(data interface{}, message string, c *gin.Context) {
Result(ERROR, data, message, c)
}