mirror of
https://github.com/go-admin-team/go-admin.git
synced 2026-09-21 18:20:50 +00:00
修改日志初始化值,level值不被覆盖
This commit is contained in:
+3
-3
@@ -27,7 +27,7 @@ func (e *Api) Error(c *gin.Context, code int, err error, msg string) {
|
|||||||
res.Msg = msg
|
res.Msg = msg
|
||||||
}
|
}
|
||||||
res.RequestId = tools.GenerateMsgIDFromContext(c)
|
res.RequestId = tools.GenerateMsgIDFromContext(c)
|
||||||
c.JSON(http.StatusOK, res.ReturnError(code))
|
c.AbortWithStatusJSON(http.StatusOK, res.ReturnError(code))
|
||||||
}
|
}
|
||||||
|
|
||||||
// OK 通常成功数据处理
|
// OK 通常成功数据处理
|
||||||
@@ -38,7 +38,7 @@ func (e *Api) OK(c *gin.Context, data interface{}, msg string) {
|
|||||||
res.Msg = msg
|
res.Msg = msg
|
||||||
}
|
}
|
||||||
res.RequestId = tools.GenerateMsgIDFromContext(c)
|
res.RequestId = tools.GenerateMsgIDFromContext(c)
|
||||||
c.JSON(http.StatusOK, res.ReturnOK())
|
c.AbortWithStatusJSON(http.StatusOK, res.ReturnOK())
|
||||||
}
|
}
|
||||||
|
|
||||||
// PageOK 分页数据处理
|
// PageOK 分页数据处理
|
||||||
@@ -53,5 +53,5 @@ func (e *Api) PageOK(c *gin.Context, result interface{}, count int, pageIndex in
|
|||||||
|
|
||||||
// Custom 兼容函数
|
// Custom 兼容函数
|
||||||
func (e *Api) Custom(c *gin.Context, data gin.H) {
|
func (e *Api) Custom(c *gin.Context, data gin.H) {
|
||||||
c.JSON(http.StatusOK, data)
|
c.AbortWithStatusJSON(http.StatusOK, data)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@ package logger
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
// Default logger
|
// Default logger
|
||||||
DefaultLogger Logger = NewHelper(NewLogger())
|
DefaultLogger Logger
|
||||||
)
|
)
|
||||||
|
|
||||||
// Logger is a generic logging interface
|
// Logger is a generic logging interface
|
||||||
|
|||||||
+3
-3
@@ -18,7 +18,7 @@ func Error(c *gin.Context, code int, err error, msg string) {
|
|||||||
res.Msg = msg
|
res.Msg = msg
|
||||||
}
|
}
|
||||||
res.RequestId = tools.GenerateMsgIDFromContext(c)
|
res.RequestId = tools.GenerateMsgIDFromContext(c)
|
||||||
c.JSON(http.StatusOK, res.ReturnError(code))
|
c.AbortWithStatusJSON(http.StatusOK, res.ReturnError(code))
|
||||||
}
|
}
|
||||||
|
|
||||||
// 通常成功数据处理
|
// 通常成功数据处理
|
||||||
@@ -29,7 +29,7 @@ func OK(c *gin.Context, data interface{}, msg string) {
|
|||||||
res.Msg = msg
|
res.Msg = msg
|
||||||
}
|
}
|
||||||
res.RequestId = tools.GenerateMsgIDFromContext(c)
|
res.RequestId = tools.GenerateMsgIDFromContext(c)
|
||||||
c.JSON(http.StatusOK, res.ReturnOK())
|
c.AbortWithStatusJSON(http.StatusOK, res.ReturnOK())
|
||||||
}
|
}
|
||||||
|
|
||||||
// 分页数据处理
|
// 分页数据处理
|
||||||
@@ -44,5 +44,5 @@ func PageOK(c *gin.Context, result interface{}, count int, pageIndex int, pageSi
|
|||||||
|
|
||||||
// 兼容函数
|
// 兼容函数
|
||||||
func Custum(c *gin.Context, data gin.H) {
|
func Custum(c *gin.Context, data gin.H) {
|
||||||
c.JSON(http.StatusOK, data)
|
c.AbortWithStatusJSON(http.StatusOK, data)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user