Add roles/ACL so admin and users can issue activation codes; exe opens review login.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+10
-7
@@ -27,12 +27,15 @@ Windows exe (通用包+激活) ──API───────────┘
|
||||
|
||||
| 表 | 用途 |
|
||||
|----|------|
|
||||
| `accounts` | 交易账户与标注 |
|
||||
| `users` | 登录用户:`role`=admin/user,普通用户必绑唯一 `account_id` |
|
||||
| `accounts` | 交易账户与标注(仅管理员创建,禁止自助注册) |
|
||||
| `machines` | 机器、指纹、在线时间 |
|
||||
| `activations` | 激活码、token、状态 |
|
||||
| `activations` | 激活码、token、状态、`created_by` 发放人 |
|
||||
| `trades` | 成交与复盘字段(entry_style / review_note / snapshot_json) |
|
||||
| `bars` | K 线缓存(symbol+timeframe+ts 唯一) |
|
||||
|
||||
**权限**:管理员看全部;普通用户复盘/激活码仅限自己的 `account_id`。激活码可由 admin 与 user 发放(user 仅自己账户)。
|
||||
|
||||
## 4. HTTP API
|
||||
|
||||
### 健康检查
|
||||
@@ -115,17 +118,17 @@ Header:`X-Device-Token`
|
||||
| `deploy/ecosystem.config.cjs` | PM2 |
|
||||
| `deploy/manage.sh` | 交互部署 |
|
||||
|
||||
## 7. 管理员密码
|
||||
## 7. 用户与密码
|
||||
|
||||
- 表 `settings`:`admin_user` / `admin_password_hash`(Werkzeug hash)
|
||||
- 首次启动用 `.env` 的 `ADMIN_PASSWORD` 写入 hash
|
||||
- 网页「系统设置」可改密,**不写回 .env**,以数据库为准
|
||||
- 表 `users`:密码为 Werkzeug hash;首次启动用 `.env` 的 `ADMIN_USER` / `ADMIN_PASSWORD` 种子管理员
|
||||
- 网页「系统设置」改当前用户密码,**不写回 .env**
|
||||
- 普通用户由管理员在 `/users` 创建并绑定账户
|
||||
|
||||
## 8. 客户端(desktop/)
|
||||
|
||||
| 文件 | 说明 |
|
||||
|------|------|
|
||||
| `gold_order_app.py` | 下单主程序(已迁入) |
|
||||
| `gold_order_app.py` | 下单主程序;含「打开复盘」→ 浏览器 `/login` |
|
||||
| `activation_dialog.py` | 首次激活 UI |
|
||||
| `hub_client.py` | HTTP 激活/上报 |
|
||||
| `device_store.py` | `~/.gold_monitor/device.json` |
|
||||
|
||||
Reference in New Issue
Block a user