/*
 * @description: rpc 实例
 * @Author: CP
 * @Date: 2020-11-12 22:49:59
 * @FilePath: \construction_management\web\api\rpc_api.go
 */
package api

import (
	"github.com/kataras/iris/v12"
	"go.mod/services"
	"google.golang.org/grpc"
)

type RpcApi struct {
	//框架-web应用上下文环境
	Ctx iris.Context
	// 需要用的service
	ServiceRpc services.RpcService
}

// func (c *RpcApi) BeforeActivation(b mvc.BeforeActivation) {
// 	fmt.Println("dd")
// }

// 实例1  RpcConnect *grpc.ClientConn
func (c *RpcApi) Get() {
	RpcConnect := c.Ctx.Values().Get("RpcConnect").(*grpc.ClientConn)
	c.ServiceRpc.Test(RpcConnect)
}
