diff --git a/tools/goctl/api/gogen/genlogic.go b/tools/goctl/api/gogen/genlogic.go index 49da400f..55332b02 100644 --- a/tools/goctl/api/gogen/genlogic.go +++ b/tools/goctl/api/gogen/genlogic.go @@ -20,13 +20,15 @@ import ( ) type {{.logic}} struct { - ctx context.Context + ctx context.Context + svcCtx *svc.ServiceContext logx.Logger } func New{{.logic}}(ctx context.Context, svcCtx *svc.ServiceContext) {{.logic}} { return {{.logic}}{ ctx: ctx, + svcCtx: svcCtx, Logger: logx.WithContext(ctx), } } diff --git a/tools/goctl/rpc/gen/genlogic.go b/tools/goctl/rpc/gen/genlogic.go index 4c2de0ed..ca4468ca 100644 --- a/tools/goctl/rpc/gen/genlogic.go +++ b/tools/goctl/rpc/gen/genlogic.go @@ -22,13 +22,15 @@ import ( ) type {{.logicName}} struct { - ctx context.Context + ctx context.Context + svcCtx *svc.ServiceContext logx.Logger } func New{{.logicName}}(ctx context.Context,svcCtx *svc.ServiceContext) *{{.logicName}} { return &{{.logicName}}{ ctx: ctx, + svcCtx: svcCtx, Logger: logx.WithContext(ctx), } }