v0.1.0: CRM/ERP 系统内测版本 - 安全加固完成
- Docker bridge 网络隔离(8000 端口封死) - Gunicorn 4 Worker 多进程 - Alembic 数据库迁移基线 - 日志轮转 20m×3 - JWT 密钥 + DB 密码 + CORS 收紧 - 3-2-1 备份链路(NAS + R740-B 冷备) - 连接池 pool_pre_ping + pool_recycle=3600
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
-- ============================================================
|
||||
-- 种子数据:用于测试登录的初始管理员账号
|
||||
-- 密码: 123456 (bcrypt hash)
|
||||
-- 执行方式: psql -U postgres -d crm_erp -f seed.sql
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 插入顶级部门
|
||||
INSERT INTO sys_departments (id, parent_id, name, sort_order, status)
|
||||
VALUES (
|
||||
'a0000000-0000-0000-0000-000000000001',
|
||||
NULL,
|
||||
'总部',
|
||||
1,
|
||||
1
|
||||
) ON CONFLICT DO NOTHING;
|
||||
|
||||
-- 2. 插入超级管理员角色 (data_scope = all)
|
||||
INSERT INTO sys_roles (id, role_name, data_scope, menu_keys, description, status)
|
||||
VALUES (
|
||||
'b0000000-0000-0000-0000-000000000001',
|
||||
'超级管理员',
|
||||
'all',
|
||||
'["dashboard","customers","customers:detail","products","orders","shipping","finance","settings"]'::JSONB,
|
||||
'拥有系统全部权限',
|
||||
1
|
||||
) ON CONFLICT DO NOTHING;
|
||||
|
||||
-- 3. 插入管理员用户 (admin / 123456)
|
||||
-- bcrypt hash of "123456" —— 直接用 Python 生成:
|
||||
-- from passlib.context import CryptContext; print(CryptContext(schemes=["bcrypt"]).hash("123456"))
|
||||
INSERT INTO sys_users (id, dept_id, role_id, username, password_hash, real_name, phone, status)
|
||||
VALUES (
|
||||
'c0000000-0000-0000-0000-000000000001',
|
||||
'a0000000-0000-0000-0000-000000000001',
|
||||
'b0000000-0000-0000-0000-000000000001',
|
||||
'admin',
|
||||
'$2b$12$N3aYJxXxEeUggclCvnVLgewUFIewfYhAB2fXLlWzI8lY4RoPjCbia',
|
||||
'系统管理员',
|
||||
'13800000000',
|
||||
1
|
||||
) ON CONFLICT DO NOTHING;
|
||||
Reference in New Issue
Block a user