This commit is contained in:
2025-12-11 11:30:18 +08:00
parent a339acd5b0
commit 0e689b5f8d
21 changed files with 1311 additions and 95 deletions
+9
View File
@@ -0,0 +1,9 @@
import { PrismaClient } from '@prisma/client';
const globalForPrisma = globalThis as unknown as {
prisma: PrismaClient | undefined;
};
export const prisma = globalForPrisma.prisma ?? new PrismaClient();
if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma;
+21
View File
@@ -0,0 +1,21 @@
export function sendMsg(msg: string, target_id: string, bot_url: string): Promise<Response> {
const replyMessage = {
user_id: String(target_id),
message: [
{
type: "text",
data: {
text: msg
}
}
]
}
return fetch(bot_url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(replyMessage)
});
}