25 lines
		
	
	
		
			616 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			616 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package svc
 | |
| 
 | |
| import (
 | |
| 	"github.com/zeromicro/go-zero/zrpc"
 | |
| 	"tianyuan-api/apps/mqs/internal/config"
 | |
| 	"tianyuan-api/apps/user/user"
 | |
| )
 | |
| 
 | |
| type ServiceContext struct {
 | |
| 	Config        config.Config
 | |
| 	WalletRpc     user.WalletServiceClient
 | |
| 	ApiRequestRpc user.ApiRequestServiceClient
 | |
| }
 | |
| 
 | |
| func NewServiceContext(c config.Config) *ServiceContext {
 | |
| 	walletRpc := user.NewWalletServiceClient(zrpc.MustNewClient(c.UserRpc).Conn())
 | |
| 	apiRequestRpc := user.NewApiRequestServiceClient(zrpc.MustNewClient(c.UserRpc).Conn())
 | |
| 
 | |
| 	return &ServiceContext{
 | |
| 		Config:        c,
 | |
| 		WalletRpc:     walletRpc,
 | |
| 		ApiRequestRpc: apiRequestRpc,
 | |
| 	}
 | |
| }
 |