...
|
...
|
@@ -3,11 +3,14 @@ package svc |
|
|
import (
|
|
|
"github.com/tiptok/gocomm/pkg/cache/gzcache"
|
|
|
"github.com/zeromicro/go-zero/core/stores/redis"
|
|
|
"github.com/zeromicro/go-zero/rest"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/config"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/middleware"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/interanl/pkg/db/repository"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/interanl/pkg/db/transaction"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/interanl/pkg/domain"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/interanl/pkg/gateway"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/interanl/pkg/gateway/authlib"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/interanl/pkg/gateway/bytelib"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/pkg/cache"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/pkg/database"
|
...
|
...
|
@@ -27,6 +30,10 @@ type ServiceContext struct { |
|
|
ObjectFieldRepository domain.ObjectFieldRepository
|
|
|
ObjectTableDataRepository domain.ObjectTableDataRepository
|
|
|
|
|
|
ApiAuthService authlib.ApiAuthService
|
|
|
LoginStatusCheck rest.Middleware
|
|
|
LogRequest rest.Middleware
|
|
|
|
|
|
ByteMetadataService bytelib.ByteMetadataService
|
|
|
}
|
|
|
|
...
|
...
|
@@ -35,12 +42,17 @@ func NewServiceContext(c config.Config) *ServiceContext { |
|
|
mlCache := cache.NewMultiLevelCache([]string{c.Redis.Host}, c.Redis.Pass)
|
|
|
redisCache := gzcache.NewClusterCache([]string{c.Redis.Host}, c.Redis.Pass)
|
|
|
redis, _ := redis.NewRedis(redis.RedisConf{Host: c.Redis.Host, Pass: c.Redis.Pass, Type: "node"})
|
|
|
|
|
|
apiAuth := authlib.ApiAuthService{
|
|
|
Service: gateway.NewService(c.ApiAuth.Name, c.ApiAuth.Host, c.ApiAuth.Timeout),
|
|
|
}
|
|
|
return &ServiceContext{
|
|
|
Config: c,
|
|
|
DB: db,
|
|
|
RedisCache: redisCache,
|
|
|
Redis: redis,
|
|
|
ApiAuthService: apiAuth,
|
|
|
LoginStatusCheck: middleware.NewLoginStatusCheckMiddleware(apiAuth).Handle,
|
|
|
LogRequest: middleware.NewLogRequestMiddleware(c.LogRequest).Handle,
|
|
|
ChartRepository: repository.NewChartRepository(cache.NewCachedRepository(mlCache)),
|
|
|
ChartSettingRepository: repository.NewChartSettingRepository(cache.NewCachedRepository(mlCache)),
|
|
|
AppPageRepository: repository.NewAppPageRepository(cache.NewCachedRepository(mlCache)),
|
...
|
...
|
|