✨ add jwt / complete the rotation verification
This commit is contained in:
@@ -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: "验证码已过期",
|
||||
}
|
||||
|
@@ -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]
|
||||
|
Reference in New Issue
Block a user