From 412020ae2a8517bcc1a6ec2b4ac4adc81cdbeb50 Mon Sep 17 00:00:00 2001 From: PandaGoAdmin <18610165312@163.com> Date: Wed, 3 Aug 2022 22:33:27 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BC=98=E5=8C=96]=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resource/template/go/router.template | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/resource/template/go/router.template b/resource/template/go/router.template index 66ef5a0..b50a620 100644 --- a/resource/template/go/router.template +++ b/resource/template/go/router.template @@ -18,29 +18,24 @@ func Init{{.ClassName}}Router(router *gin.RouterGroup) { } routerGroup := router.Group("{{.BusinessName}}") - {{.ClassName}}ListLog := ginx.NewLogInfo("获取{{.FunctionName}}分页列表") routerGroup.GET("list", func(c *gin.Context) { - ginx.NewReqCtx(c).WithLog({{.ClassName}}ListLog).Handle(s.Get{{.ClassName}}List) + ginx.NewReqCtx(c).WithLog("获取{{.FunctionName}}分页列表").Handle(s.Get{{.ClassName}}List) }) - {{.ClassName}}Log := ginx.NewLogInfo("获取{{.FunctionName}}信息") routerGroup.GET(":{{.PkJsonField}}", func(c *gin.Context) { - ginx.NewReqCtx(c).WithLog({{.ClassName}}Log).Handle(s.Get{{.ClassName}}) + ginx.NewReqCtx(c).WithLog("获取{{.FunctionName}}信息").Handle(s.Get{{.ClassName}}) }) - insert{{.ClassName}}Log := ginx.NewLogInfo("添加{{.FunctionName}}信息") routerGroup.POST("", func(c *gin.Context) { - ginx.NewReqCtx(c).WithLog(insert{{.ClassName}}Log).Handle(s.Insert{{.ClassName}}) + ginx.NewReqCtx(c).WithLog("添加{{.FunctionName}}信息").Handle(s.Insert{{.ClassName}}) }) - update{{.ClassName}}Log := ginx.NewLogInfo("修改{{.FunctionName}}信息") routerGroup.PUT("", func(c *gin.Context) { - ginx.NewReqCtx(c).WithLog(update{{.ClassName}}Log).Handle(s.Update{{.ClassName}}) + ginx.NewReqCtx(c).WithLog("修改{{.FunctionName}}信息").Handle(s.Update{{.ClassName}}) }) - delete{{.ClassName}}Log := ginx.NewLogInfo("删除{{.FunctionName}}信息") routerGroup.DELETE(":{{.PkJsonField}}", func(c *gin.Context) { - ginx.NewReqCtx(c).WithLog(delete{{.ClassName}}Log).Handle(s.Delete{{.ClassName}}) + ginx.NewReqCtx(c).WithLog("删除{{.FunctionName}}信息").Handle(s.Delete{{.ClassName}}) }) }