Initial commit: 风影 OA 全栈源码(API/Web/Flutter/IM)

含 Phase 1.1 IM seq 排序、断线重连、多端已读同步与微信式语音转文字 UI。
排除 node_modules、构建产物、安装包与 .env 密钥。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-02 10:04:03 +00:00
commit 76f266645d
507 changed files with 99891 additions and 0 deletions
+65
View File
@@ -0,0 +1,65 @@
import { PrismaClient } from '@prisma/client';
import * as argon2 from 'argon2';
const prisma = new PrismaClient();
async function main() {
const username = '18115604840';
const password = '123456';
const role = await prisma.role.findFirst({ where: { code: 'admin' } });
if (!role) throw new Error('缺少 admin 角色,请先执行 prisma seed');
const root =
(await prisma.department.findFirst({ where: { code: 'ROOT' } })) ||
(await prisma.department.findFirst({ orderBy: { sortNo: 'asc' } }));
if (!root) throw new Error('缺少部门');
let emp = await prisma.employee.findFirst({ where: { mobile: username } });
if (!emp) {
emp = await prisma.employee.create({
data: {
name: '系统管理员',
employeeNo: 'E-ADMIN',
departmentId: root.id,
title: '管理员',
restSchedule: 'DOUBLE',
employmentStatus: 'REGULAR',
mobile: username,
hiredAt: new Date(),
},
});
} else if (!emp.mobile) {
emp = await prisma.employee.update({ where: { id: emp.id }, data: { mobile: username } });
}
const hash = await argon2.hash(password);
let user = await prisma.user.findFirst({ where: { username } });
if (!user) {
user = await prisma.user.create({
data: {
username,
passwordHash: hash,
displayName: emp.name,
employeeId: emp.id,
mustChangePassword: false,
status: 'ACTIVE',
},
});
} else {
user = await prisma.user.update({
where: { id: user.id },
data: { employeeId: emp.id, status: 'ACTIVE' },
});
}
await prisma.userRole.upsert({
where: { userId_roleId: { userId: user.id, roleId: role.id } },
create: { userId: user.id, roleId: role.id },
update: {},
});
console.log('prod admin ok', username);
}
main()
.then(() => prisma.$disconnect())
.catch(async (e) => {
console.error(e);
await prisma.$disconnect();
process.exit(1);
});