新增index首页服务
This commit is contained in:
20
apps/index/internal/svc/servicecontext.go
Normal file
20
apps/index/internal/svc/servicecontext.go
Normal file
@@ -0,0 +1,20 @@
|
||||
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,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user