This commit is contained in:
1 parent
8efd032cc6
commit
df38dccbf1
735 files changed
+128321
-120870
No files matched your search
@@ -10,10 +10,12 @@ import { prisma } from "@/lib/prisma";
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export async function GET(_req: Request) {
|
||||
try {
|
||||
const count = await cached("online_count", 10_000, () => prisma.user.count({ where: { online: "1" } }));
|
||||
return apiJson({ count });
|
||||
} catch {
|
||||
return apiJson({ count: 0 });
|
||||
}
|
||||
try {
|
||||
const count = await cached("online_count", 10_000, () =>
|
||||
prisma.user.count({ where: { online: "1" } }),
|
||||
);
|
||||
return apiJson({ count });
|
||||
} catch {
|
||||
return apiJson({ count: 0 });
|
||||
}
|
||||
}
|
||||
+10
-10
@@ -10,15 +10,15 @@ import { prisma } from "@/lib/prisma";
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export async function GET(_req: Request) {
|
||||
try {
|
||||
const users = await prisma.user.findMany({
|
||||
where: { online: "1" },
|
||||
select: { username: true, look: true },
|
||||
take: 100,
|
||||
});
|
||||
try {
|
||||
const users = await prisma.user.findMany({
|
||||
where: { online: "1" },
|
||||
select: { username: true, look: true },
|
||||
take: 100,
|
||||
});
|
||||
|
||||
return apiJson({ users });
|
||||
} catch {
|
||||
return apiJson({ users: [] });
|
||||
}
|
||||
return apiJson({ users });
|
||||
} catch {
|
||||
return apiJson({ users: [] });
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user