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-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-07 11:11:04 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
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,
|
|
|
|
}),
|
2024-06-07 18:47:40 +08:00
|
|
|
ZltxOrder: zltx.NewZltxOrder(c.ZLTX),
|
|
|
|
Market: market.NewMarket(c.Market),
|
2024-06-07 11:11:04 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func DbModel(datasource string, c config.Config) *Model {
|
2024-06-07 18:47:40 +08:00
|
|
|
//sqlConn := sqlx.NewMysql(datasource)
|
2024-06-07 11:11:04 +08:00
|
|
|
return &Model{
|
2024-06-07 18:47:40 +08:00
|
|
|
//ClientModel: genModel.NewServerClientModel(sqlConn, c.Cache),
|
2024-06-07 11:11:04 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
type Model struct {
|
2024-06-07 18:47:40 +08:00
|
|
|
//ClientModel genModel.ServerClientModel
|
2024-06-07 11:11:04 +08:00
|
|
|
}
|