Browse Source

出来排序问题

jax 4 months ago
parent
commit
2f81ab39ad
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/app/api/match/route.js

+ 2 - 2
src/app/api/match/route.js

@@ -130,7 +130,7 @@ export async function GET(request) {
         const skip = (current - 1) * pageSize;
         const totalMatches = await Match.countDocuments(searchQuery);
         const matchesData = await Match.find(searchQuery)
-          .sort({ date: -1, time: -1 })
+          .sort({ date: -1, time: 1 })
           .skip(skip)
           .limit(pageSize);
 
@@ -176,7 +176,7 @@ export async function GET(request) {
           date: { $gte: startDate, $lte: endDate },
           status: { $in: ["未开始", "进行中"] },
           ...dateTypeFilter,
-        }).sort({ time: 1 });
+        }).sort({ date: 1, time: 1 });
 
         response = NextResponse.json({ success: true, data: matches });
         break;