Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
36fd04cac9 | |||
956cf69a82 |
@ -53,9 +53,8 @@ func New() gin.HandlerFunc {
|
||||
b := stringBuilderPool.Get().(*strings.Builder)
|
||||
b.Reset()
|
||||
|
||||
b.WriteString("[")
|
||||
b.WriteString(fmt.Sprintf("%36s", trace))
|
||||
b.WriteString("] | ")
|
||||
b.WriteString(" | ")
|
||||
b.WriteString(fmt.Sprintf("%3d", status))
|
||||
b.WriteString(" | ")
|
||||
b.WriteString(fmt.Sprintf("%15s", ip))
|
||||
|
12
resp/resp.go
12
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
|
||||
|
||||
|
Reference in New Issue
Block a user