Commit 8c546994 authored by duanjinfei's avatar duanjinfei

fix user rank

parent d55cba90
......@@ -21,13 +21,19 @@ async function cacheUserRank(supabase) {
const { data: userData, error: userError } = await supabase.from('user').select('*').order('rank', { ascending: true }).limit(100);
const updatesUserData = userData.map((user, index) => ({
...user,
rank: index + 1,
}));
if (userError) {
console.error('Error fetching top 100 users:', error);
return new Response(JSON.stringify({ error: 'Failed to fetch users' }), { status: 500 });
}
// 2. 将数据 JSON 序列化
const jsonData = JSON.stringify(userData);
const jsonData = JSON.stringify(updatesUserData);
// 3. 生成文件名
const timestamp = Math.floor(Date.now() / 3600000) * 3600; // 计算整点的时间戳
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment