From bf8784737fa27b54b5b609b3e45f254ce2dda4e4 Mon Sep 17 00:00:00 2001 From: Matrix-X Date: Fri, 20 Sep 2024 15:28:42 +0800 Subject: [PATCH] feat(pro): add uc --- internal/svc/servicecontext.go | 3 +++ internal/uc/pro.go | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 internal/uc/pro.go diff --git a/internal/svc/servicecontext.go b/internal/svc/servicecontext.go index 74b730bc..c62b7b23 100644 --- a/internal/svc/servicecontext.go +++ b/internal/svc/servicecontext.go @@ -12,6 +12,7 @@ type ServiceContext struct { Config config.Config PowerX *uc.PowerXUseCase OpenAPI *uc.OpenAPIUseCase + Pro *uc.ProUseCase Custom *uc.CustomUseCase MPCustomerJWTAuth rest.Middleware @@ -29,6 +30,7 @@ type ServiceContext struct { func NewServiceContext(c config.Config, opts ...Option) *ServiceContext { powerx, _ := uc.NewPowerXUseCase(&c) openapi, _ := uc.NewOpenAPIUseCase(&c, powerx) + pro, _ := uc.NewProUseCase(&c, powerx) custom, _ := uc.NewCustomUseCase(&c, powerx) svcCtx := ServiceContext{ @@ -43,6 +45,7 @@ func NewServiceContext(c config.Config, opts ...Option) *ServiceContext { UserNoPermJWTAuth: middleware.NewUserNoPermJWTAuthMiddleware(&c, powerx).Handle, OpenAPIJWTAuth: middleware.NewOpenAPIJWTAuthMiddleware(&c, powerx).Handle, OpenAPIPlatformGet: middleware.NewOpenAPIPlatformGetMiddleware(&c, powerx).Handle, + Pro: pro, Custom: custom, } diff --git a/internal/uc/pro.go b/internal/uc/pro.go new file mode 100644 index 00000000..2ad740ac --- /dev/null +++ b/internal/uc/pro.go @@ -0,0 +1,20 @@ +package uc + +import ( + "PowerX/internal/config" + "gorm.io/gorm" +) + +type ProUseCase struct { + db *gorm.DB +} + +func NewProUseCase(conf *config.Config, pxUseCase *PowerXUseCase) (uc *ProUseCase, clean func()) { + + uc = &ProUseCase{} + + // 需要打印当时系统的Timezone + return uc, func() { + + } +}