add jwt / complete the rotation verification

This commit is contained in:
landaiqing
2024-08-12 22:05:59 +08:00
parent 54f6256c00
commit 48c5aeb0f4
31 changed files with 1702 additions and 44 deletions

View File

@@ -13,6 +13,7 @@ const (
ParamsMatchError ErrorCode = 1008
ParamsNotUniqueError ErrorCode = 1009
FileSizeExceeded ErrorCode = 1010
CaptchaExpireError ErrorCode = 1011
)
type ErrorMap map[ErrorCode]string
@@ -28,4 +29,5 @@ var ErrMap = ErrorMap{
1008: "参数值不匹配",
1009: "参数值不唯一",
1010: "超出文件上传大小限制",
1011: "验证码已过期",
}

View File

@@ -38,12 +38,17 @@ func OkWithMessage(msg string, c *gin.Context) {
func Fail(msg string, data any, c *gin.Context) {
Result(FAIL, msg, data, false, c)
}
func FailWithCodeAndMessage(code int, msg string, c *gin.Context) {
Result(code, msg, nil, false, c)
}
func FailWithMessage(msg string, c *gin.Context) {
Result(FAIL, msg, nil, false, c)
}
func FailWithData(data any, c *gin.Context) {
Result(FAIL, "fail", data, false, c)
}
func FailWithNull(c *gin.Context) {
Result(FAIL, "fail", nil, false, c)
}
func FailWithCode(code ErrorCode, c *gin.Context) {
msg, ok := ErrMap[code]