mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-08-27 20:54:33 +08:00
Error code standardization
This commit is contained in:
parent
29c1bb86d8
commit
8e8ee2b968
@ -58,9 +58,9 @@ func (*Friend) Find(ctx context.Context, ownerUserID string) (friends []*Friend,
|
|||||||
return friends, err
|
return friends, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*Friend) Take(ctx context.Context, ownerUserID, friendUserID string) (group *Group, err error) {
|
func (*Friend) Take(ctx context.Context, ownerUserID, friendUserID string) (friend *Friend, err error) {
|
||||||
group = &Group{}
|
friend = &Friend{}
|
||||||
defer trace_log.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "ownerUserID", ownerUserID, "friendUserID", friendUserID, "group", *group)
|
defer trace_log.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "ownerUserID", ownerUserID, "friendUserID", friendUserID, "group", *friend)
|
||||||
err = utils.Wrap(FriendDB.Where("owner_user_id = ? and friend_user_id", ownerUserID, friendUserID).Take(group).Error, "")
|
err = utils.Wrap(FriendDB.Where("owner_user_id = ? and friend_user_id", ownerUserID, friendUserID).Take(friend).Error, "")
|
||||||
return group, err
|
return friend, err
|
||||||
}
|
}
|
||||||
|
@ -56,10 +56,11 @@ func (*User) Find(ctx context.Context, userIDs []string) (users []*User, err err
|
|||||||
return users, err
|
return users, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*User) Take(ctx context.Context, userIDs []string) (users []*User, err error) {
|
func (*User) Take(ctx context.Context, userID string) (user *User, err error) {
|
||||||
|
user = &User{}
|
||||||
defer func() {
|
defer func() {
|
||||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userIDs", userIDs, "users", users)
|
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID, "user", *user)
|
||||||
}()
|
}()
|
||||||
err = utils.Wrap(userDB.Where("user_id in (?)", userIDs).Take(&users).Error, "")
|
err = utils.Wrap(userDB.Where("user_id = ?", userID).Take(&user).Error, "")
|
||||||
return users, err
|
return user, err
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user