Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#145 修复迭代器拉取飞书群历史消息,重复拉取消息的bug #147

Open
wants to merge 1 commit into
base: v3_main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions service/im/v1/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -12189,12 +12189,13 @@ func (iterator *ListChatIterator) Next() (bool, *ListChat, error) {
return false, nil, nil
}

// 为0则拉取数据
// 为0则拉取数据,或者上一页数据读取完成,尝试拉取下一页数据
if iterator.index == 0 || iterator.index >= len(iterator.items) {
if iterator.index != 0 && iterator.nextPageToken == nil {
//没有下一页数据了
if iterator.index != 0 && (iterator.nextPageToken == nil || len(*iterator.nextPageToken) == 0) {
return false, nil, nil
}
if iterator.nextPageToken != nil {
if iterator.nextPageToken != nil && len(*iterator.nextPageToken) != 0 {
iterator.req.apiReq.QueryParams.Set("page_token", *iterator.nextPageToken)
}
resp, err := iterator.listFunc(iterator.ctx, iterator.req, iterator.options...)
Expand Down