feat: tool 添加 gin local
This commit is contained in:
@ -3,6 +3,7 @@ package resp
|
||||
import (
|
||||
"errors"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/spf13/cast"
|
||||
)
|
||||
|
||||
type res struct {
|
||||
@ -53,6 +54,10 @@ func _r(c *gin.Context, r *res, args ...any) {
|
||||
r.Data = args[1]
|
||||
case 3:
|
||||
r.Err = args[2]
|
||||
case 4:
|
||||
if code, err := cast.ToIntE(args[3]); err == nil {
|
||||
r.Code = code
|
||||
}
|
||||
}
|
||||
|
||||
if r.Msg == "" {
|
||||
|
Reference in New Issue
Block a user