Error code standardization

This commit is contained in:
skiffer-git
2023-02-14 12:06:58 +08:00
parent 731112e61b
commit 9eb0ee55f3
4 changed files with 42 additions and 8 deletions
+16
View File
@@ -1,15 +1,31 @@
package check
import (
"Open_IM/pkg/common/config"
discoveryRegistry "Open_IM/pkg/discoveryregistry"
"Open_IM/pkg/proto/conversation"
pbConversation "Open_IM/pkg/proto/conversation"
"context"
"google.golang.org/grpc"
)
type ConversationChecker struct {
zk discoveryRegistry.SvcDiscoveryRegistry
}
func NewConversationChecker(zk discoveryRegistry.SvcDiscoveryRegistry) *ConversationChecker {
return &ConversationChecker{zk: zk}
}
func (c *ConversationChecker) ModifyConversationField(ctx context.Context, req *pbConversation.ModifyConversationFieldReq) (resp *pbConversation.ModifyConversationFieldResp, err error) {
cc, err := c.getConn()
if err != nil {
return nil, err
}
resp, err = conversation.NewConversationClient(cc).ModifyConversationField(ctx, req)
return
}
func (c *ConversationChecker) getConn() (*grpc.ClientConn, error) {
return c.zk.GetConn(config.Config.RpcRegisterName.OpenImConversationName)
}