This commit is contained in:
aozhiwei 2024-07-13 14:49:10 +08:00
parent ac6d1f71f5
commit 5610bc1f75

View File

@ -7,6 +7,8 @@ import (
"sync" "sync"
"errors" "errors"
"gorm.io/gorm" "gorm.io/gorm"
"net/http"
"github.com/gin-gonic/gin"
) )
const ( 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() { func init() {
switch os.Getenv("SERVER_ENV") { switch os.Getenv("SERVER_ENV") {
case "TEST": case "TEST":