You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Open-IM-Server/internal/api/group/group1.go

36 lines
1.0 KiB

2 years ago
package group
import (
"OpenIM/internal/api2rpc"
"OpenIM/pkg/apistruct"
"OpenIM/pkg/common/config"
"OpenIM/pkg/proto/group"
"github.com/OpenIMSDK/openKeeper"
"github.com/gin-gonic/gin"
)
type Group struct {
zk *openKeeper.ZkClient
}
func (g *Group) getGroupClient() (group.GroupClient, error) {
conn, err := g.zk.GetConn(config.Config.RpcRegisterName.OpenImGroupName)
if err != nil {
return nil, err
}
return group.NewGroupClient(conn), nil
}
func (g *Group) KickGroupMember(c *gin.Context) {
api2rpc.Rpc(
&apistruct.KickGroupMemberReq{},
&apistruct.KickGroupMemberResp{},
group.GroupClient.KickGroupMember,
).Must(c, g.getGroupClient).Call()
}
//func (g *Group) KickGroupMember1(c *gin.Context) {
// var fn func(client group.GroupClient, ctx context.Context, in *group.KickGroupMemberReq, opts ...grpc.CallOption) (*group.KickGroupMemberResp, error) = group.GroupClient.KickGroupMember
// api2rpc.Rpc(&apistruct.KickGroupMemberReq{}, &apistruct.KickGroupMemberResp{}, fn).Must(c, g.getGroupClient).Call()
//}