feat: 平台管理员端 — SUPER_ADMIN 角色 + 企业租户管理 + 用户管理 + 数据总览

This commit is contained in:
selfrelease
2026-07-29 11:49:48 +08:00
parent fb36b10402
commit 987a4678f7
17 changed files with 1744 additions and 14 deletions
+46
View File
@@ -0,0 +1,46 @@
/**
* 平台管理员种子脚本
* 创建 SUPER_ADMIN 角色的平台管理员账号
*
* 用法: npx tsx prisma/seed-platform-admin.ts
*/
import { PrismaClient } from '@prisma/client'
import bcrypt from 'bcryptjs'
const prisma = new PrismaClient()
async function main() {
const phone = '13800000000'
const existing = await prisma.user.findUnique({ where: { phone } })
if (existing) {
console.log(`平台管理员已存在: ${phone},跳过创建`)
return
}
const passwordHash = await bcrypt.hash('admin123456', 10)
const admin = await prisma.user.create({
data: {
name: '平台超级管理员',
phone,
passwordHash,
role: 'SUPER_ADMIN',
orgId: null,
},
})
console.log('===== 平台管理员创建成功 =====')
console.log(`姓名: ${admin.name}`)
console.log(`手机号: ${admin.phone}`)
console.log(`密码: admin123456`)
console.log(`角色: SUPER_ADMIN`)
}
main()
.catch((e) => {
console.error(e)
process.exit(1)
})
.finally(async () => {
await prisma.$disconnect()
})