tianyuan-api-server/apps/mqs/internal/svc/servicecontext.go

25 lines
616 B
Go
Raw Normal View History

2024-10-02 00:57:17 +08:00
package svc
2024-10-12 20:41:55 +08:00
import (
"github.com/zeromicro/go-zero/zrpc"
"tianyuan-api/apps/mqs/internal/config"
"tianyuan-api/apps/user/user"
)
2024-10-02 00:57:17 +08:00
type ServiceContext struct {
2024-10-12 20:41:55 +08:00
Config config.Config
WalletRpc user.WalletServiceClient
ApiRequestRpc user.ApiRequestServiceClient
2024-10-02 00:57:17 +08:00
}
func NewServiceContext(c config.Config) *ServiceContext {
2024-10-12 20:41:55 +08:00
walletRpc := user.NewWalletServiceClient(zrpc.MustNewClient(c.UserRpc).Conn())
apiRequestRpc := user.NewApiRequestServiceClient(zrpc.MustNewClient(c.UserRpc).Conn())
2024-10-02 00:57:17 +08:00
return &ServiceContext{
2024-10-12 20:41:55 +08:00
Config: c,
WalletRpc: walletRpc,
ApiRequestRpc: apiRequestRpc,
2024-10-02 00:57:17 +08:00
}
}