feat: batch update - gift card breakdown spec, backend APIs, miniprogram pages, ETL finance recharge, docs & migrations
This commit is contained in:
@@ -24,7 +24,7 @@ apps/backend/
|
||||
│ ├── routers/ # 17 个路由模块(详见 API 参考)
|
||||
│ ├── schemas/ # Pydantic 请求/响应模型
|
||||
│ ├── services/ # 业务逻辑层
|
||||
│ ├── middleware/ # 中间件
|
||||
│ ├── middleware/ # 中间件(ResponseWrapper 全局响应包装)
|
||||
│ └── ws/ # WebSocket(实时日志)
|
||||
├── tests/ # 后端测试
|
||||
├── pyproject.toml # 依赖声明
|
||||
@@ -48,6 +48,14 @@ API 文档自动生成于:
|
||||
|
||||
## 架构概览
|
||||
|
||||
### 全局响应包装与 Schema 规范(RNS1.0)
|
||||
|
||||
后端通过 ASGI 中间件和 Pydantic 基类实现统一的响应格式:
|
||||
|
||||
- `ResponseWrapperMiddleware`(`middleware/response_wrapper.py`):所有 JSON 成功响应(2xx)自动包装为 `{ "code": 0, "data": <原始响应体> }`;SSE(`text/event-stream`)和非 JSON 响应透传不包装
|
||||
- `http_exception_handler` / `unhandled_exception_handler`:异常统一格式化为 `{ "code": <HTTP状态码>, "message": <错误详情> }`,未捕获异常返回 500 并记录完整堆栈
|
||||
- `CamelModel`(`schemas/base.py`):所有小程序 API 响应 schema 的基类,`alias_generator=to_camel` 自动将 snake_case 字段转为 camelCase 输出,同时通过 `populate_by_name=True` 接受两种格式输入
|
||||
|
||||
### 双数据库连接
|
||||
|
||||
| 连接 | 数据库 | 用途 | 函数 |
|
||||
@@ -104,8 +112,9 @@ JWT 令牌分两种:
|
||||
|------|------|------|------|
|
||||
| `/api/auth` | `auth.py` | 管理后台登录/刷新令牌 | 无 |
|
||||
| `/api/xcx-auth` | `xcx_auth.py` | 小程序微信登录/申请/状态/店铺切换 | 部分 |
|
||||
| `/api/xcx/tasks` | `xcx_tasks.py` | 小程序任务列表/置顶/放弃 | JWT |
|
||||
| `/api/xcx/tasks` | `xcx_tasks.py` | 小程序任务列表/详情/置顶/放弃/恢复 | JWT |
|
||||
| `/api/xcx/notes` | `xcx_notes.py` | 小程序备注 CRUD | JWT |
|
||||
| `/api/xcx/performance` | `xcx_performance.py` | 小程序绩效概览/明细 | JWT |
|
||||
| `/api/admin/applications` | `admin_applications.py` | 管理端申请审核 | JWT |
|
||||
| `/api/business-day` | `business_day.py` | 营业日配置查询 | JWT |
|
||||
| `/api/tasks` | `tasks.py` | 任务注册表/Flow 定义/配置验证 | JWT |
|
||||
@@ -139,7 +148,10 @@ JWT 令牌分两种:
|
||||
| `task_generator.py` | 任务生成器(基于 WBI/NCI 指数) |
|
||||
| `task_manager.py` | 任务管理(置顶/放弃/状态变更) |
|
||||
| `task_expiry.py` | 任务过期检查与处理 |
|
||||
| `task_manager.py` | 任务管理(CRUD + 列表扩展 + 详情) |
|
||||
| `performance_service.py` | 绩效概览 + 明细(FDW 查询) |
|
||||
| `note_service.py` | 备注服务(CRUD + 星星评分) |
|
||||
| `fdw_queries.py` | FDW 查询集中封装(门店隔离 + DWD-DOC 规则) |
|
||||
| `note_reclassifier.py` | 备注重分类(召回完成后回填) |
|
||||
| `recall_detector.py` | 召回完成检测(ETL 数据更新触发) |
|
||||
| `trigger_scheduler.py` | 触发器调度器(cron/interval/event) |
|
||||
@@ -160,6 +172,7 @@ neozqyy-shared(workspace 引用)
|
||||
## Roadmap
|
||||
|
||||
- [ ] RBAC 权限中间件(基于 `auth.role_permissions` 表)
|
||||
- [x] 全局响应包装中间件 + CamelModel 基类(RNS1.0)
|
||||
- [ ] 数据看板 API(助教业绩、财务日报、客户分析)
|
||||
- [ ] 任务审批流 API
|
||||
- [ ] 消息推送(微信模板消息/订阅消息)
|
||||
|
||||
Reference in New Issue
Block a user