Files
open-im-server/internal/common/check/conversation.go
T

32 lines
872 B
Go
Raw Normal View History

2023-02-14 10:57:52 +08:00
package check
import (
2023-02-14 12:06:58 +08:00
"Open_IM/pkg/common/config"
2023-02-14 10:57:52 +08:00
discoveryRegistry "Open_IM/pkg/discoveryregistry"
2023-02-14 12:06:58 +08:00
"Open_IM/pkg/proto/conversation"
2023-02-14 10:57:52 +08:00
pbConversation "Open_IM/pkg/proto/conversation"
"context"
2023-02-14 12:06:58 +08:00
"google.golang.org/grpc"
2023-02-14 10:57:52 +08:00
)
type ConversationChecker struct {
zk discoveryRegistry.SvcDiscoveryRegistry
}
2023-02-14 12:06:58 +08:00
func NewConversationChecker(zk discoveryRegistry.SvcDiscoveryRegistry) *ConversationChecker {
return &ConversationChecker{zk: zk}
}
2023-02-14 16:33:18 +08:00
func (c *ConversationChecker) ModifyConversationField(ctx context.Context, req *pbConversation.ModifyConversationFieldReq) error {
2023-02-14 12:06:58 +08:00
cc, err := c.getConn()
if err != nil {
2023-02-14 16:33:18 +08:00
return err
2023-02-14 12:06:58 +08:00
}
2023-02-14 16:33:18 +08:00
_, err = conversation.NewConversationClient(cc).ModifyConversationField(ctx, req)
return err
2023-02-14 10:57:52 +08:00
}
2023-02-14 12:06:58 +08:00
func (c *ConversationChecker) getConn() (*grpc.ClientConn, error) {
return c.zk.GetConn(config.Config.RpcRegisterName.OpenImConversationName)
}