diff --git a/sysutils.go b/sysutils.go index 2a547e8..0d599fd 100644 --- a/sysutils.go +++ b/sysutils.go @@ -7,6 +7,8 @@ import ( "sync" "errors" "gorm.io/gorm" + "net/http" + "github.com/gin-gonic/gin" ) const ( @@ -96,6 +98,20 @@ func BatchReleaseLock(locks []*sync.Mutex) { } } +func RspErr(c *gin.Context, errCode int32, errMsg string) { + c.JSON(http.StatusOK, gin.H{ + "errcode": errCode, + "errmsg": errMsg, + }) +} + +func RspErr2(c *gin.Context, code int32, message string) { + c.JSON(http.StatusOK, gin.H{ + "code": code, + "message": message, + }) +} + func init() { switch os.Getenv("SERVER_ENV") { case "TEST":