refactor:

- zap.Any("err", err) 更改为 zap.Error(err) 提高性能
This commit is contained in:
SliverHorn
2021-11-16 02:13:54 +08:00
parent 98703f192a
commit ed2e254cf4
24 changed files with 106 additions and 106 deletions

View File

@@ -30,7 +30,7 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Create{{.StructName}}(c *gin.Con
var {{.Abbreviation}} autocode.{{.StructName}}
_ = c.ShouldBindJSON(&{{.Abbreviation}})
if err := {{.Abbreviation}}Service.Create{{.StructName}}({{.Abbreviation}}); err != nil {
global.GVA_LOG.Error("创建失败!", zap.Any("err", err))
global.GVA_LOG.Error("创建失败!", zap.Error(err))
response.FailWithMessage("创建失败", c)
} else {
response.OkWithMessage("创建成功", c)
@@ -50,7 +50,7 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Delete{{.StructName}}(c *gin.Con
var {{.Abbreviation}} autocode.{{.StructName}}
_ = c.ShouldBindJSON(&{{.Abbreviation}})
if err := {{.Abbreviation}}Service.Delete{{.StructName}}({{.Abbreviation}}); err != nil {
global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
global.GVA_LOG.Error("删除失败!", zap.Error(err))
response.FailWithMessage("删除失败", c)
} else {
response.OkWithMessage("删除成功", c)
@@ -70,7 +70,7 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Delete{{.StructName}}ByIds(c *gi
var IDS request.IdsReq
_ = c.ShouldBindJSON(&IDS)
if err := {{.Abbreviation}}Service.Delete{{.StructName}}ByIds(IDS); err != nil {
global.GVA_LOG.Error("批量删除失败!", zap.Any("err", err))
global.GVA_LOG.Error("批量删除失败!", zap.Error(err))
response.FailWithMessage("批量删除失败", c)
} else {
response.OkWithMessage("批量删除成功", c)
@@ -90,7 +90,7 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Update{{.StructName}}(c *gin.Con
var {{.Abbreviation}} autocode.{{.StructName}}
_ = c.ShouldBindJSON(&{{.Abbreviation}})
if err := {{.Abbreviation}}Service.Update{{.StructName}}({{.Abbreviation}}); err != nil {
global.GVA_LOG.Error("更新失败!", zap.Any("err", err))
global.GVA_LOG.Error("更新失败!", zap.Error(err))
response.FailWithMessage("更新失败", c)
} else {
response.OkWithMessage("更新成功", c)
@@ -110,7 +110,7 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Find{{.StructName}}(c *gin.Conte
var {{.Abbreviation}} autocode.{{.StructName}}
_ = c.ShouldBindQuery(&{{.Abbreviation}})
if err, re{{.Abbreviation}} := {{.Abbreviation}}Service.Get{{.StructName}}({{.Abbreviation}}.ID); err != nil {
global.GVA_LOG.Error("查询失败!", zap.Any("err", err))
global.GVA_LOG.Error("查询失败!", zap.Error(err))
response.FailWithMessage("查询失败", c)
} else {
response.OkWithData(gin.H{"re{{.Abbreviation}}": re{{.Abbreviation}}}, c)
@@ -130,7 +130,7 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Get{{.StructName}}List(c *gin.Co
var pageInfo autocodeReq.{{.StructName}}Search
_ = c.ShouldBindQuery(&pageInfo)
if err, list, total := {{.Abbreviation}}Service.Get{{.StructName}}InfoList(pageInfo); err != nil {
global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
global.GVA_LOG.Error("获取失败!", zap.Error(err))
response.FailWithMessage("获取失败", c)
} else {
response.OkWithDetailed(response.PageResult{