Skip to content

Commit

Permalink
Fix. 修复返回的最新消息时间错误的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
RavelloH committed Jan 21, 2025
1 parent d3cba5e commit 102d762
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/app/api/notice/check/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,12 @@ export async function GET(request) {
userUid: user.uid,
},
orderBy: {
createdAt: 'desc', // 将 'asc' 改为 'desc' 以降序排列
createdAt: 'desc',
},
});

// 若请求到新数据,则设置 newestTime = 最后一条通知的 createdAt
let newestTime = latestTime;
if (notices.length > 0) {
newestTime = notices[notices.length - 1].createdAt;
newestTime = notices[0].createdAt;
}

return Response.json({
Expand Down

0 comments on commit 102d762

Please sign in to comment.