From 535350fd6f193344cf8c520e07d8c7108a20a73e Mon Sep 17 00:00:00 2001 From: "mula.liu" Date: Wed, 24 Dec 2025 11:16:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=E7=B3=BB=E7=BB=9F=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.example | 4 ++-- .../add_access_pass_to_projects.sql | 5 ---- backend/scripts/init_database.sql | 20 ++++++++-------- backend/scripts/init_db.py | 24 +++++++++---------- 4 files changed, 24 insertions(+), 29 deletions(-) delete mode 100644 backend/migrations/add_access_pass_to_projects.sql diff --git a/.env.example b/.env.example index 86e0f3b..4e78a29 100644 --- a/.env.example +++ b/.env.example @@ -41,6 +41,6 @@ STORAGE_PATH=./storage # ==================== 管理员账号配置 ==================== # 初始管理员账号信息 ADMIN_USERNAME=admin -ADMIN_PASSWORD=Admin@123456 -ADMIN_EMAIL=admin@example.com +ADMIN_PASSWORD=admin@123 +ADMIN_EMAIL=admin@unisspace.com ADMIN_NICKNAME=系统管理员 diff --git a/backend/migrations/add_access_pass_to_projects.sql b/backend/migrations/add_access_pass_to_projects.sql deleted file mode 100644 index 738af35..0000000 --- a/backend/migrations/add_access_pass_to_projects.sql +++ /dev/null @@ -1,5 +0,0 @@ --- 为projects表添加access_pass字段(访问密码) --- 执行时间:2025-12-20 - -ALTER TABLE projects -ADD COLUMN access_pass VARCHAR(100) NULL COMMENT '访问密码(用于分享链接)' AFTER visit_count; diff --git a/backend/scripts/init_database.sql b/backend/scripts/init_database.sql index 62795de..ec1dbc2 100644 --- a/backend/scripts/init_database.sql +++ b/backend/scripts/init_database.sql @@ -174,22 +174,22 @@ INSERT INTO `roles` (`role_name`, `role_code`, `description`, `is_system`) VALUE -- 插入初始菜单数据 INSERT INTO `system_menus` (`id`, `parent_id`, `menu_name`, `menu_code`, `menu_type`, `path`, `icon`, `sort_order`, `permission`) VALUES -(1, 0, '项目管理', 'project', 1, '/projects', 'FolderOutlined', 1, NULL), -(2, 1, '我的项目', 'my_projects', 2, '/projects/my', NULL, 1, 'project:view'), -(3, 1, '创建项目', 'create_project', 3, NULL, NULL, 2, 'project:create'), -(4, 1, '编辑项目', 'edit_project', 3, NULL, NULL, 3, 'project:edit'), -(5, 1, '删除项目', 'delete_project', 3, NULL, NULL, 4, 'project:delete'), -(10, 0, '文档管理', 'document', 1, '/documents', 'FileTextOutlined', 2, NULL), -(11, 10, '查看文档', 'view_document', 3, NULL, NULL, 1, 'document:view'), -(12, 10, '编辑文档', 'edit_document', 3, NULL, NULL, 2, 'document:edit'), -(13, 10, '删除文档', 'delete_document', 3, NULL, NULL, 3, 'document:delete'), +(1, 0, '项目管理', 'project', 1, NULL, 'FolderOutlined', 1, NULL), +(2, 1, '我的项目', 'projects:my', 2, '/projects', NULL, 1, 'project:view'), +(3, 1, '创建项目', 'project', 3, NULL, NULL, 2, 'project:create'), +(4, 1, '编辑项目', 'project:edit', 3, NULL, NULL, 3, 'project:edit'), +(5, 1, '删除项目', 'project:delete', 3, NULL, NULL, 4, 'project:delete'), +(10, 0, '知识库管理', 'knowledge', 1, NULL, 'FileTextOutlined', 2, NULL), +(11, 10, '我的知识库', 'knowledge:view', 3, '/knowledges', NULL, 1, 'knowledge:view'), +(12, 10, '编辑知识库', 'knowledge:edit', 3, NULL, NULL, 2, 'knowledge:edit'), +(13, 10, '删除知识库', 'knowledge:delete', 3, NULL, NULL, 3, 'knowledge:delete'), (20, 0, '系统管理', 'system', 1, '/system', 'SettingOutlined', 3, NULL), (21, 20, '用户管理', 'user_manage', 2, '/system/users', NULL, 1, 'system:user:view'), (22, 20, '角色管理', 'role_manage', 2, '/system/roles', NULL, 2, 'system:role:view'); -- 创建默认管理员用户(密码: admin@123) INSERT INTO `users` (`username`, `password_hash`, `nickname`, `is_superuser`, `status`) VALUES -('admin', '$2b$12$TkyjVycb8PHk/835Py4Kz.r.us7YqPAbF.89NQ7TrU5/r/lTqVAUu', '系统管理员', 1, 1); +('admin', '$2b$12$gQlTcKxyQKRYQtTT0Db.mexAsAYTJre9G8OSlzl3H3gMNTfXijiZy', '系统管理员', 1, 1); -- 将管理员用户分配超级管理员角色 INSERT INTO `user_roles` (`user_id`, `role_id`) VALUES (1, 1); diff --git a/backend/scripts/init_db.py b/backend/scripts/init_db.py index 54f05a1..d67d10a 100644 --- a/backend/scripts/init_db.py +++ b/backend/scripts/init_db.py @@ -107,11 +107,11 @@ async def init_menus(): id=8, parent_id=0, menu_name="个人桌面", - menu_code="dashboard", + menu_code="desktop", menu_type=1, - path="/dashboard", - component="Dashboard", - icon="DashboardOutlined", + path="/desktop", + component="Desktop", + icon="DesktopOutlined", sort_order=1, visible=1, status=1 @@ -120,11 +120,11 @@ async def init_menus(): id=9, parent_id=0, menu_name="管理面板", - menu_code="admin_panel", + menu_code="dashboard", menu_type=1, - path="/admin", - component="AdminPanel", - icon="ControlOutlined", + path="/dashboard", + component="Dashboard", + icon="DashboardOutlined", sort_order=2, visible=1, status=1 @@ -161,7 +161,7 @@ async def init_menus(): menu_name="我的项目", menu_code="projects:my", menu_type=1, - path="/projects/my", + path="/projects", component="MyProjects", icon="FolderOutlined", sort_order=1, @@ -211,7 +211,7 @@ async def init_menus(): menu_name="我的知识库", menu_code="knowledge:my", menu_type=1, - path="/knowledge/my", + path="/knowledge", component="MyKnowledge", icon="ReadOutlined", sort_order=1, @@ -298,8 +298,8 @@ async def init_admin_user(): # 从环境变量获取管理员信息 admin_username = os.getenv("ADMIN_USERNAME", "admin") - admin_password = os.getenv("ADMIN_PASSWORD", "Admin@123456") - admin_email = os.getenv("ADMIN_EMAIL", "admin@example.com") + admin_password = os.getenv("ADMIN_PASSWORD", "admin@123") + admin_email = os.getenv("ADMIN_EMAIL", "admin@unisspace.com") admin_nickname = os.getenv("ADMIN_NICKNAME", "系统管理员") async with async_session() as session: