1
This commit is contained in:
parent
ac6d1f71f5
commit
5610bc1f75
16
sysutils.go
16
sysutils.go
@ -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":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user