Skip to content

Commit db52ec6

Browse files
committed
msap添加limit和prev
1 parent 7c2f34c commit db52ec6

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

proto

Submodule proto updated 1 file

service/msap/msap.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,17 @@ func sync(c *gin.Context) {
156156
// 从请求中获取groupid和last_msgid
157157
groupID := c.GetInt64("groupid")
158158
lastMsgIDStr := c.Query("msgid")
159+
startSync := c.Query("sync") != "false"
160+
usePrev := c.Query("prev") == "true"
161+
msgLimitStr := c.Query("limit")
162+
if msgLimitStr == "" {
163+
msgLimitStr = "128"
164+
}
165+
msgLimit64, err := strconv.Atoi(msgLimitStr)
166+
if err != nil || msgLimit64 <= 0 {
167+
msgLimit64 = 128
168+
}
169+
msgLimit := int32(msgLimit64)
159170

160171
if groupID == 0 {
161172
jsonData, _ := json.Marshal(gin.H{
@@ -200,6 +211,9 @@ func sync(c *gin.Context) {
200211
req := &pb.SyncMessageRequest{
201212
Groupid: groupID,
202213
LastMsgid: msgid,
214+
Prev: usePrev,
215+
Sync: startSync,
216+
Limit: msgLimit,
203217
}
204218

205219
// 调用gRPC服务端流方法

0 commit comments

Comments
 (0)