test-errcode
wangchuxiao 2 years ago
parent 9ea3e4c758
commit b6f20d1772

@ -48,19 +48,19 @@ func Start(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) e
if err != nil {
return err
}
// user := rpcclient.NewUserClient(client)
user := rpcclient.NewUserClient(client)
database := controller.InitGroupDatabase(db, rdb, mongo.GetDatabase())
pbGroup.RegisterGroupServer(server, &groupServer{
GroupDatabase: database,
// User: user,
// Notification: notification.NewGroupNotificationSender(database, client, func(ctx context.Context, userIDs []string) ([]rpcclient.CommonUser, error) {
// users, err := user.GetUsersInfo(ctx, userIDs)
// if err != nil {
// return nil, err
// }
// return utils.Slice(users, func(e *sdkws.UserInfo) rpcclient.CommonUser { return e }), nil
// }),
// conversationRpcClient: rpcclient.NewConversationClient(client),
User: user,
Notification: notification.NewGroupNotificationSender(database, client, func(ctx context.Context, userIDs []string) ([]rpcclient.CommonUser, error) {
users, err := user.GetUsersInfo(ctx, userIDs)
if err != nil {
return nil, err
}
return utils.Slice(users, func(e *sdkws.UserInfo) rpcclient.CommonUser { return e }), nil
}),
conversationRpcClient: rpcclient.NewConversationClient(client),
})
return nil
}

@ -69,6 +69,6 @@ func (f *FriendRequestGorm) FindFromUserID(ctx context.Context, fromUserID strin
if err != nil {
return nil, 0, utils.Wrap(err, "")
}
err = utils.Wrap(f.db(ctx).Where("from_user_id = ? ", fromUserID).Limit(int(showNumber)).Offset(int(pageNumber*showNumber-1)).Find(&friendRequests).Error, "")
err = utils.Wrap(f.db(ctx).Where("from_user_id = ? ", fromUserID).Limit(int(showNumber)).Offset(int(pageNumber-1)*int(showNumber)).Find(&friendRequests).Error, "")
return
}

Loading…
Cancel
Save