feat(users): 拆分 C 端身份并迁移历史聊天

- digital.users: 独立开户登录与凭据版本校验,后台查看用户及原始会话
- 017迁移: 保留聊天消息、实验分组和人工指定期限,迁移历史账号归属
- tests: 覆盖身份隔离、凭据失效、会话归属和长账号登录,同步 README
This commit is contained in:
湛兮
2026-10-27 18:56:19 +08:00
parent 57c89f4f32
commit b9d1a7f6bd
14 changed files with 747 additions and 32 deletions
+6 -1
View File
@@ -67,7 +67,12 @@ export async function experiments() {
/** 创建时间从受信账号表获取,所有查询中的表名均来自固定枚举。 */
export async function accountCreated(account: string) {
const [kind, id] = account.split(":");
const table = kind === "super_admin" ? "super_admins" : "employees";
const table =
kind === "user"
? "dh_users"
: kind === "super_admin"
? "super_admins"
: "employees";
const [row] = await rows<{ created_at: Date }>(
`SELECT created_at FROM ${table} WHERE id=?`,
[Number(id)],