refactor(notification): migrate cursor pagination to use unified cursor package
All checks were successful
Build Backend / build (push) Successful in 3m58s
Build Backend / build-docker (push) Successful in 2m52s

- Add new GetByReceiverIDCursor method with context support and generic cursor types
- Rename old implementation to GetByReceiverIDCursorLegacy for backward compatibility
- Update handler to use legacy interface temporarily during migration
- Use CursorBuilder pattern for consistent pagination across services
This commit is contained in:
lafay
2026-03-21 03:21:07 +08:00
parent 639ee55696
commit d7c7a51f77
2 changed files with 69 additions and 7 deletions

View File

@@ -82,8 +82,8 @@ func (h *SystemMessageHandler) GetSystemMessagesByCursor(c *gin.Context) {
cursorStr := c.Query("cursor")
pageSize, _ := strconv.Atoi(c.DefaultQuery("page_size", "20"))
// 获取当前用户的系统通知
notifications, nextCursor, hasMore, err := h.notifyRepo.GetByReceiverIDCursor(userID, cursorStr, pageSize)
// 获取当前用户的系统通知(使用兼容旧版接口)
notifications, nextCursor, hasMore, err := h.notifyRepo.GetByReceiverIDCursorLegacy(userID, cursorStr, pageSize)
if err != nil {
response.InternalServerError(c, "failed to get system messages")
return