turms-im / turms

🕊️ The world's most advanced open source instant messaging engine for 100K~10M concurrent users https://turms-im.github.io/docs
Apache License 2.0
1.74k stars 269 forks source link

messageService.queryMessagesWithTotal 疑问 #1493

Open lovemianhuatang opened 3 months ago

lovemianhuatang commented 3 months ago

我开启了turms.service.message.use-conversation-id=true。

messageService.queryMessagesWithTotal 返回的total,好像只查询了第一条的Message的senderId。

const USER_ONE_ID = '999';
const USER_TWO_ID = '1000';

clientUserOne.messageService.queryMessagesWithTotal({
                fromIds: [targetId], // targetId=1000
                areGroupMessages: false
            })

clientUserTwo.messageService.queryMessagesWithTotal({
                fromIds: [targetId], // targetId=999
                areGroupMessages: false
            })
image

clientUserOne(userId=999)的total=0 符合预期吗?

JamesChenX commented 3 months ago

If you don't call the method with maxCount, the param is set to 1 by default, you can set it to null explicitly, so turms-server will use the default max limit count set by the property turms.service.message.default-available-messages-number-with-total.

image

lovemianhuatang commented 3 months ago

我是想查total的总数,目前只会用第一条message的senderId来计算total,如果第一条是自己发送的,total就为0了; 预期应该要返回对方的给我发送的message total ,而不是自己的

lovemianhuatang commented 3 months ago

@JamesChenX 我没传maxCount,maxCount使用的是默认的1,因为我只想查询消息的total

image image
lovemianhuatang commented 3 months ago

我的预期:

image image

还有另外一个需求:total的计算希望能支持排除系统消息或召回消息的选项。