Files
medical-mall/docs/ops/2026-02-18__admin__auth-delivery-infrastructure-integration.md

60 lines
3.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 权限、物流及系统基础设施全量集成报告
## 摘要
本次对 Admin 侧进行了大规模的基础设施补齐与核心管理模块重构。完成了权限管理Auth/RBAC、物流设置Delivery Staff/Stations、系统通用配置ml_system_configs以及数据概览Statistic与系统维护Maintain模块的端到端数据库接入。彻底解决了这些模块此前长期存在的 Mock 问题。
## 动机
虽然商城的业务模块(商品、订单等)已基本闭环,但支撑系统运行的“底座”模块(权限控制、系统开关、物流资源等)仍处于静态模拟阶段。为了实现生产级的管理后台,必须建立统一的配置存储体系、完善的权限分配机制以及真实的物流资源管理。
## 影响范围
- **核心底座**:系统配置读写、全站聚合统计。
- **权限安全**:角色管理、菜单权限树配置、管理员分配。
- **物流资源**:配送员库、提货点/核销点管理。
- **应用配置**公众号、小程序、APP 及 PC 端参数持久化。
## 变更清单
### 1. 数据库资产 (SQL)
- **Schema (10_schema)**:
- `admin/ml_system_configs_v1.sql`: 统一配置表。
- `user/ak_auth_system_v1.sql`: 角色、权限、关联表 (RBAC)。
- `delivery/ak_delivery_system_v1.sql`: 配送员、提货点表。
- **RLS (20_rls)**:
- `admin/ml_system_configs_rls_v1.sql`
- `auth/ak_auth_rls_v1.sql`
- `delivery/ak_delivery_rls_v1.sql`
- **RPC (30_rpc)**:
- **Admin**: `rpc_admin_system_config_get/save`, `rpc_admin_get_overall_stats`, `rpc_admin_get_system_info`
- **Auth**: `rpc_admin_get_admin_list`, `rpc_admin_get_role_list/save/delete`, `rpc_admin_get_permission_list/save/delete`
- **Delivery**: 配送员管理 (list/save/delete)、提货点管理 (list/save/delete)。
### 2. 前端服务层 (UTS)
- `services/admin/systemConfigService.uts` (新增)
- `services/admin/authService.uts` (新增)
- `services/admin/deliveryService.uts` (新增)
- `services/admin/maintainService.uts` (新增)
### 3. UI 页面重构 (去 Mock)
- **权限类**: `auth/admin.uvue`, `auth/role.uvue`, `auth/permission.uvue`
- **物流类**: `delivery/staff.uvue`, `delivery/station.uvue`
- **配置类**: `setting/system/config.uvue`, `app/wechat/config.uvue`, `app/routine/config.uvue`, `app/mobile/config.uvue`, `app/pc/config.uvue`
- **综合类**: `statistic/index.uvue`, `maintain/sys/info.uvue`
## 兼容性与风险
- **数据迁移**:启用 RLS 后,需确保管理员用户在 `ak_users` 中的 `role` 字段准确设置为 `admin`,否则将无法调用管理端 RPC。
- **逻辑依赖**:配送员和提货点管理依赖于 `ml_orders` 等核心表已存在。
## 回滚方案
1. 数据库:依次 DROP 刚才创建的 20 余个 RPC 函数及 5 张核心业务表。
2. 代码:通过 `git checkout` 恢复重构的 10 余个页面文件及 Service 目录。
## 验证方式
1. **统计验证**:进入“数据概览”,确认销售额、用户数等指标非 0 且与数据库一致。
2. **配置验证**:在“系统设置”修改网站名称并提交,刷新页面确认数据持久化。
3. **权限验证**:在“角色管理”添加新身份,确认能在“管理员管理”中进行分配。
4. **物流验证**:添加配送员后,确认列表分页展示正确且支持实时状态切换。
## 关联规范
- 遵循 `AGENT_PROJECT_SPEC.md` 规范。
- 对齐项目统一的角色鉴权与 RPC 分层口径。