package svc import ( "github.com/zeromicro/go-zero/core/stores/redis" "trasfer_middleware/cmd/rpc/internal/config" "trasfer_middleware/cmd/rpc/internal/logic/po/market" "trasfer_middleware/cmd/rpc/internal/logic/po/rs" "trasfer_middleware/cmd/rpc/internal/logic/po/zltx" ) type ServiceContext struct { Config config.Config RedisClient *redis.Redis ZltxOrder *zltx.ZltxOrder Market *market.Market RS *rs.RS } func NewServiceContext(c config.Config) *ServiceContext { return &ServiceContext{ Config: c, RedisClient: redis.MustNewRedis(redis.RedisConf{ Host: c.Redis.Host, Type: c.Redis.Type, Pass: c.Redis.Pass, }), ZltxOrder: zltx.NewZltxOrder(c.ZLTX), Market: market.NewMarket(c.Market), RS: rs.NewRs(c.RS), } } /*func DbModel(datasource string, c config.Config) *Model { sqlConn := sqlx.NewMysql(datasource) return &Model{ MarketLogs: genModel.NewServerMiddleMarketLogsModel(sqlConn, c.Cache), ZLTXLogs: genModel.NewServerMiddleZltxLogsModel(sqlConn, c.Cache), } } type Model struct { MarketLogs genModel.ServerMiddleMarketLogsModel ZLTXLogs genModel.ServerMiddleZltxLogsModel }*/