transfer_middleware/cmd/rpc/internal/svc/serviceContext.go

36 lines
937 B
Go

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/new_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
NewMarket *new_market.NewMarketStruct
}
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),
NewMarket: new_market.NewNewMarket(c.NewMarket, c.Mq),
}
}