21 lines
451 B
Go
21 lines
451 B
Go
|
package svc
|
||
|
|
||
|
import (
|
||
|
"github.com/zeromicro/go-zero/zrpc"
|
||
|
"tianyuan-api/apps/index/internal/config"
|
||
|
"tianyuan-api/apps/sentinel/sentinel"
|
||
|
)
|
||
|
|
||
|
type ServiceContext struct {
|
||
|
Config config.Config
|
||
|
ProductRpc sentinel.ProductClient
|
||
|
}
|
||
|
|
||
|
func NewServiceContext(c config.Config) *ServiceContext {
|
||
|
productRpc := sentinel.NewProductClient(zrpc.MustNewClient(c.SentinelRpc).Conn())
|
||
|
return &ServiceContext{
|
||
|
Config: c,
|
||
|
ProductRpc: productRpc,
|
||
|
}
|
||
|
}
|