Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
6cd0fa3d6c | |||
9c8460fc44 |
4
opt/opt.go
Normal file
4
opt/opt.go
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
package opt
|
||||||
|
|
||||||
|
type Config struct {
|
||||||
|
}
|
@ -3,7 +3,7 @@ package resp
|
|||||||
const (
|
const (
|
||||||
Msg200 = "操作成功"
|
Msg200 = "操作成功"
|
||||||
Msg400 = "参数错误"
|
Msg400 = "参数错误"
|
||||||
Msg401 = "登录信息不存在或已过期, 请重新登录"
|
Msg401 = "该账号登录已失效, 请重新登录"
|
||||||
Msg401NoMulti = "用户已在其他地方登录"
|
Msg401NoMulti = "用户已在其他地方登录"
|
||||||
Msg403 = "权限不足"
|
Msg403 = "权限不足"
|
||||||
Msg404 = "资源不存在"
|
Msg404 = "资源不存在"
|
||||||
|
@ -70,6 +70,7 @@ func _r(c *gin.Context, r *res, args ...any) {
|
|||||||
func R400(c *gin.Context, args ...any) {
|
func R400(c *gin.Context, args ...any) {
|
||||||
r := &res{
|
r := &res{
|
||||||
Status: 400,
|
Status: 400,
|
||||||
|
Code: -1,
|
||||||
}
|
}
|
||||||
|
|
||||||
_r(c, r, args...)
|
_r(c, r, args...)
|
||||||
@ -78,6 +79,7 @@ func R400(c *gin.Context, args ...any) {
|
|||||||
func R401(c *gin.Context, args ...any) {
|
func R401(c *gin.Context, args ...any) {
|
||||||
r := &res{
|
r := &res{
|
||||||
Status: 401,
|
Status: 401,
|
||||||
|
Code: -1,
|
||||||
}
|
}
|
||||||
|
|
||||||
_r(c, r, args...)
|
_r(c, r, args...)
|
||||||
@ -86,6 +88,7 @@ func R401(c *gin.Context, args ...any) {
|
|||||||
func R403(c *gin.Context, args ...any) {
|
func R403(c *gin.Context, args ...any) {
|
||||||
r := &res{
|
r := &res{
|
||||||
Status: 403,
|
Status: 403,
|
||||||
|
Code: -1,
|
||||||
}
|
}
|
||||||
|
|
||||||
_r(c, r, args...)
|
_r(c, r, args...)
|
||||||
@ -94,6 +97,7 @@ func R403(c *gin.Context, args ...any) {
|
|||||||
func R500(c *gin.Context, args ...any) {
|
func R500(c *gin.Context, args ...any) {
|
||||||
r := &res{
|
r := &res{
|
||||||
Status: 500,
|
Status: 500,
|
||||||
|
Code: -1,
|
||||||
}
|
}
|
||||||
|
|
||||||
_r(c, r, args...)
|
_r(c, r, args...)
|
||||||
@ -102,6 +106,7 @@ func R500(c *gin.Context, args ...any) {
|
|||||||
func R501(c *gin.Context, args ...any) {
|
func R501(c *gin.Context, args ...any) {
|
||||||
r := &res{
|
r := &res{
|
||||||
Status: 501,
|
Status: 501,
|
||||||
|
Code: -1,
|
||||||
}
|
}
|
||||||
|
|
||||||
_r(c, r, args...)
|
_r(c, r, args...)
|
||||||
|
@ -11,3 +11,8 @@ func Must(errs ...error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func MustWithData[T any](data T, err error) T {
|
||||||
|
Must(err)
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user