From 89238818ebd3b6f5fda309cb3052be352dc0a069 Mon Sep 17 00:00:00 2001 From: shaw Date: Wed, 26 Nov 2025 19:45:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dapikeys=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E7=8A=B6=E6=80=81=E6=8E=92=E5=BA=8F=E5=A4=B1=E6=95=88?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/models/redis.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/models/redis.js b/src/models/redis.js index b39578bb..10f10e7a 100644 --- a/src/models/redis.js +++ b/src/models/redis.js @@ -334,17 +334,19 @@ class RedisClient { // 4. 排序 filteredKeys.sort((a, b) => { - let aVal = a[sortBy] - let bVal = b[sortBy] + // status 排序实际上使用 isActive 字段(API Key 没有 status 字段) + const effectiveSortBy = sortBy === 'status' ? 'isActive' : sortBy + let aVal = a[effectiveSortBy] + let bVal = b[effectiveSortBy] // 日期字段转时间戳 - if (['createdAt', 'expiresAt', 'lastUsedAt'].includes(sortBy)) { + if (['createdAt', 'expiresAt', 'lastUsedAt'].includes(effectiveSortBy)) { aVal = aVal ? new Date(aVal).getTime() : 0 bVal = bVal ? new Date(bVal).getTime() : 0 } // 布尔字段转数字 - if (sortBy === 'isActive' || sortBy === 'status') { + if (effectiveSortBy === 'isActive') { aVal = aVal ? 1 : 0 bVal = bVal ? 1 : 0 }