2024-06-07 11:11:04 +08:00
|
|
|
package svc
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/zeromicro/go-zero/core/stores/redis"
|
|
|
|
"trasfer_middleware/cmd/rpc/internal/config"
|
2024-06-07 14:28:29 +08:00
|
|
|
"trasfer_middleware/cmd/rpc/internal/logic/po/market"
|
2024-10-15 18:35:45 +08:00
|
|
|
"trasfer_middleware/cmd/rpc/internal/logic/po/new_market"
|
2024-06-18 16:34:14 +08:00
|
|
|
"trasfer_middleware/cmd/rpc/internal/logic/po/rs"
|
2024-06-07 11:11:04 +08:00
|
|
|
"trasfer_middleware/cmd/rpc/internal/logic/po/zltx"
|
|
|
|
)
|
|
|
|
|
|
|
|
type ServiceContext struct {
|
|
|
|
Config config.Config
|
|
|
|
RedisClient *redis.Redis
|
2024-06-07 18:47:40 +08:00
|
|
|
ZltxOrder *zltx.ZltxOrder
|
|
|
|
Market *market.Market
|
2024-06-18 16:34:14 +08:00
|
|
|
RS *rs.RS
|
2024-10-15 18:35:45 +08:00
|
|
|
NewMarket *new_market.NewMarketStruct
|
2024-06-07 11:11:04 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func NewServiceContext(c config.Config) *ServiceContext {
|
2024-06-12 13:46:14 +08:00
|
|
|
|
2024-06-07 11:11:04 +08:00
|
|
|
return &ServiceContext{
|
|
|
|
Config: c,
|
|
|
|
RedisClient: redis.MustNewRedis(redis.RedisConf{
|
|
|
|
Host: c.Redis.Host,
|
|
|
|
Type: c.Redis.Type,
|
|
|
|
Pass: c.Redis.Pass,
|
|
|
|
}),
|
2024-06-07 18:47:40 +08:00
|
|
|
ZltxOrder: zltx.NewZltxOrder(c.ZLTX),
|
|
|
|
Market: market.NewMarket(c.Market),
|
2024-06-18 16:34:14 +08:00
|
|
|
RS: rs.NewRs(c.RS),
|
2024-10-15 18:35:45 +08:00
|
|
|
NewMarket: new_market.NewNewMarket(c.NewMarket, c.Mq),
|
2024-06-07 11:11:04 +08:00
|
|
|
}
|
|
|
|
}
|