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/zltx" ) type ServiceContext struct { Config config.Config RedisClient *redis.Redis ZltxOrder *zltx.ZltxOrder Market *market.Market } 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), } } /*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 }*/