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