v4.0.14概览和日报
CI / verify (pull_request) Waiting to run

This commit is contained in:
2026-09-02 21:11:58 +08:00
parent e5fe8b903a
commit 68a4b7f984
41 changed files with 3815 additions and 1098 deletions
@@ -0,0 +1,54 @@
/**
* 创建 wecom_report_push(若不存在)并写入日/周/月默认行。
* 不依赖 Prisma Client 新 model,可在 generate 之前执行。
*/
import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
const PLACEHOLDER = 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=PENDING';
async function main() {
await prisma.$executeRawUnsafe(`
CREATE TABLE IF NOT EXISTS wecom_report_push (
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
kind VARCHAR(16) NOT NULL,
name VARCHAR(64) NOT NULL,
webhook_url VARCHAR(512) NOT NULL,
enabled TINYINT(1) NOT NULL DEFAULT 0,
mention_wecom_user_id VARCHAR(64) NULL,
send_hour INT NOT NULL DEFAULT 20,
send_minute INT NOT NULL DEFAULT 0,
send_weekday INT NOT NULL DEFAULT 1,
send_month_day INT NOT NULL DEFAULT 1,
last_sent_period VARCHAR(16) NULL,
last_sent_at DATETIME(3) NULL,
created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
updated_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),
UNIQUE KEY wecom_report_push_kind_key (kind)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
`);
const seeds: Array<[string, string, number]> = [
['daily', '经营日报', 20],
['weekly', '经营周报', 9],
['monthly', '经营月报', 9],
];
for (const [kind, name, hour] of seeds) {
await prisma.$executeRaw`
INSERT IGNORE INTO wecom_report_push
(kind, name, webhook_url, enabled, send_hour, send_minute, send_weekday, send_month_day)
VALUES
(${kind}, ${name}, ${PLACEHOLDER}, 0, ${hour}, 0, 1, 1)
`;
}
console.log('migrate-wecom-report done');
}
main()
.catch((e) => {
console.error(e);
process.exit(1);
})
.finally(async () => {
await prisma.$disconnect();
});
+20
View File
@@ -546,6 +546,26 @@ model WecomPushTemplate {
@@map("wecom_push_template")
}
/// 企微群机器人经营报告推送(日报 / 周报 / 月报,与事件消息推送分开)
model WecomReportPush {
id BigInt @id @default(autoincrement()) @db.UnsignedBigInt
kind String @unique @db.VarChar(16)
name String @db.VarChar(64)
webhookUrl String @map("webhook_url") @db.VarChar(512)
enabled Boolean @default(false)
mentionWecomUserId String? @map("mention_wecom_user_id") @db.VarChar(64)
sendHour Int @default(20) @map("send_hour")
sendMinute Int @default(0) @map("send_minute")
sendWeekday Int @default(1) @map("send_weekday")
sendMonthDay Int @default(1) @map("send_month_day")
lastSentPeriod String? @map("last_sent_period") @db.VarChar(16)
lastSentAt DateTime? @map("last_sent_at") @db.DateTime(3)
createdAt DateTime @default(now()) @map("created_at") @db.DateTime(3)
updatedAt DateTime @updatedAt @map("updated_at") @db.DateTime(3)
@@map("wecom_report_push")
}
/// HQ 语言模型 API 配置(非超管仅可见/可开关自己创建的)
model LlmApiConfig {
id BigInt @id @default(autoincrement()) @db.UnsignedBigInt