修复upstash方式数据导入

This commit is contained in:
mtvpls
2026-01-12 20:10:37 +08:00
parent 83b3315fba
commit f1ced03517
3 changed files with 118 additions and 102 deletions

View File

@@ -155,8 +155,8 @@ async function getUserPasswordV2(username: string): Promise<string | null> {
// 直接调用hGetAll获取完整用户信息包括密码
const userInfoKey = `user:${username}:info`;
if (typeof storage.withRetry === 'function' && storage.client?.hGetAll) {
const userInfo = await storage.withRetry(() => storage.client.hGetAll(userInfoKey));
if (typeof storage.withRetry === 'function' && storage.client?.hgetall) {
const userInfo = await storage.withRetry(() => storage.client.hgetall(userInfoKey));
if (userInfo && userInfo.password) {
return userInfo.password;
}

View File

@@ -149,10 +149,10 @@ export async function POST(req: NextRequest) {
}
// 使用storage.withRetry直接设置用户信息
await storage.withRetry(() => storage.client.hSet(userInfoKey, userInfo));
await storage.withRetry(() => storage.client.hset(userInfoKey, userInfo));
// 添加到用户列表
await storage.withRetry(() => storage.client.zAdd('user:list', {
await storage.withRetry(() => storage.client.zadd('user:list', {
score: createdAt,
value: username,
}));