Merge 366c05e4c33231283c1a0b28e9b1eca4aea02603 into a5b427a3d6c051697bd4c94d26ba48bf91811714

This commit is contained in:
OpenIM-Gordon 2026-10-18 05:28:55 +00:00 committed by GitHub
commit 87dc0fdd29
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 1 deletions

View File

@ -133,7 +133,7 @@ func (*MsgDocModel) GetMsgIndex(seq int64) int64 {
}
func (*MsgDocModel) GetLimitForSingleDoc(seq int64) int64 {
return seq % singleGocMsgNum
return (seq - 1) % singleGocMsgNum
}
func (*MsgDocModel) indexGen(conversationID string, seqSuffix int64) string {

View File

@ -0,0 +1,12 @@
package model
import "testing"
func TestMsgDocModelGetLimitForSingleDoc(t *testing.T) {
model := new(MsgDocModel)
for _, test := range []struct{ seq, want int64 }{{1, 0}, {99, 98}, {100, 99}, {101, 0}} {
if got := model.GetLimitForSingleDoc(test.seq); got != test.want {
t.Errorf("GetLimitForSingleDoc(%d) = %d, want %d", test.seq, got, test.want)
}
}
}