diff --git a/resp/resp.go b/resp/resp.go index 097ceb1..741ffae 100644 --- a/resp/resp.go +++ b/resp/resp.go @@ -30,6 +30,18 @@ func R200(c *gin.Context, data any, msgs ...string) { c.AbortWithStatusJSON(200, r) } +func RC(c *gin.Context, status int, args ...any) { + code := 1 + if status != 200 { + code = -1 + } + + _r(c, &res{ + Status: status, + Code: code, + }, args...) +} + func RE(c *gin.Context, err error) { var re *Error