mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-05-12 06:21:16 +08:00
Error code standardization
This commit is contained in:
parent
8435508f35
commit
461fd5f1ff
@ -5,11 +5,10 @@ import (
|
||||
"context"
|
||||
)
|
||||
|
||||
func Access(ctx context.Context, ownerUserID string) (err error) {
|
||||
_, err = GetUsersInfo(ctx, ownerUserID)
|
||||
func (u *UserCheck) Access(ctx context.Context, ownerUserID string) (err error) {
|
||||
_, err = u.GetUsersInfo(ctx, ownerUserID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return tokenverify.CheckAccessV3(ctx, ownerUserID)
|
||||
|
||||
}
|
||||
|
@ -1,11 +1,21 @@
|
||||
package check
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/config"
|
||||
discoveryRegistry "Open_IM/pkg/discoveryregistry"
|
||||
sdkws "Open_IM/pkg/proto/sdkws"
|
||||
"context"
|
||||
"errors"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
func GetFriendsInfo(ctx context.Context, ownerUserID, friendUserID string) (*sdkws.FriendInfo, error) {
|
||||
type FriendChecker struct {
|
||||
zk discoveryRegistry.SvcDiscoveryRegistry
|
||||
}
|
||||
|
||||
func (f *FriendChecker) GetFriendsInfo(ctx context.Context, ownerUserID, friendUserID string) (*sdkws.FriendInfo, error) {
|
||||
return nil, errors.New("TODO:GetUserInfo")
|
||||
}
|
||||
func (u *FriendChecker) getConn() (*grpc.ClientConn, error) {
|
||||
return u.zk.GetConn(config.Config.RpcRegisterName.OpenImFriendName)
|
||||
}
|
||||
|
@ -13,9 +13,10 @@ import (
|
||||
)
|
||||
|
||||
type Check struct {
|
||||
user *check.UserCheck
|
||||
group *check.GroupChecker
|
||||
msg *check.MsgCheck
|
||||
user *check.UserCheck
|
||||
group *check.GroupChecker
|
||||
msg *check.MsgCheck
|
||||
friend *check.FriendChecker
|
||||
}
|
||||
|
||||
type NotificationMsg struct {
|
||||
|
@ -1,7 +1,6 @@
|
||||
package notification
|
||||
|
||||
import (
|
||||
"Open_IM/internal/common/check"
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/constant"
|
||||
pbFriend "Open_IM/pkg/proto/friend"
|
||||
@ -112,7 +111,7 @@ func (c *Check) FriendAddedNotification(ctx context.Context, operationID, opUser
|
||||
friendAddedTips.OpUser.Nickname = user[0].Nickname
|
||||
friendAddedTips.OpUser.FaceURL = user[0].FaceURL
|
||||
|
||||
friend, err := check.GetFriendsInfo(ctx, fromUserID, toUserID)
|
||||
friend, err := c.friend.GetFriendsInfo(ctx, fromUserID, toUserID)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user