This commit is contained in:
withchao
2023-03-07 12:19:30 +08:00
parent 3fe9ee22fe
commit 4c5613084c
40 changed files with 315 additions and 297 deletions
+2 -1
View File
@@ -4,6 +4,7 @@ import (
"OpenIM/pkg/common/config"
"OpenIM/pkg/common/constant"
discoveryRegistry "OpenIM/pkg/discoveryregistry"
"OpenIM/pkg/errs"
"OpenIM/pkg/proto/friend"
sdkws "OpenIM/pkg/proto/sdkws"
"context"
@@ -67,7 +68,7 @@ func (f *FriendChecker) GetAllPageFriends(ctx context.Context, ownerUserID strin
if tmp.Total == int32(len(resp)) {
return resp, nil
}
return nil, constant.ErrData.Wrap("The total number of results and expectations are different, but result is nil")
return nil, errs.ErrData.Wrap("The total number of results and expectations are different, but result is nil")
}
resp = append(resp, tmp.FriendsInfo...)
page++
+3 -2
View File
@@ -4,6 +4,7 @@ import (
"OpenIM/pkg/common/config"
"OpenIM/pkg/common/constant"
discoveryRegistry "OpenIM/pkg/discoveryregistry"
"OpenIM/pkg/errs"
"OpenIM/pkg/proto/group"
sdkws "OpenIM/pkg/proto/sdkws"
"OpenIM/pkg/utils"
@@ -41,7 +42,7 @@ func (g *GroupChecker) GetGroupInfos(ctx context.Context, groupIDs []string, com
if ids := utils.Single(groupIDs, utils.Slice(resp.GroupInfos, func(e *sdkws.GroupInfo) string {
return e.GroupID
})); len(ids) > 0 {
return nil, constant.ErrGroupIDNotFound.Wrap(strings.Join(ids, ","))
return nil, errs.ErrGroupIDNotFound.Wrap(strings.Join(ids, ","))
}
}
return resp.GroupInfos, nil
@@ -81,7 +82,7 @@ func (g *GroupChecker) GetGroupMemberInfos(ctx context.Context, groupID string,
if ids := utils.Single(userIDs, utils.Slice(resp.Members, func(e *sdkws.GroupMemberFullInfo) string {
return e.UserID
})); len(ids) > 0 {
return nil, constant.ErrNotInGroupYet.Wrap(strings.Join(ids, ","))
return nil, errs.ErrNotInGroupYet.Wrap(strings.Join(ids, ","))
}
}
return resp.Members, nil
+2 -2
View File
@@ -2,8 +2,8 @@ package check
import (
"OpenIM/pkg/common/config"
"OpenIM/pkg/common/constant"
"OpenIM/pkg/discoveryregistry"
"OpenIM/pkg/errs"
"OpenIM/pkg/proto/sdkws"
"OpenIM/pkg/proto/user"
"OpenIM/pkg/utils"
@@ -41,7 +41,7 @@ func (u *UserCheck) GetUsersInfos(ctx context.Context, userIDs []string, complet
if ids := utils.Single(userIDs, utils.Slice(resp.UsersInfo, func(e *sdkws.UserInfo) string {
return e.UserID
})); len(ids) > 0 {
return nil, constant.ErrUserIDNotFound.Wrap(strings.Join(ids, ","))
return nil, errs.ErrUserIDNotFound.Wrap(strings.Join(ids, ","))
}
}
return resp.UsersInfo, nil