Files
gecko/srde/miniprogram/README.md
Daniel a94bd44c3a Initial commit
Made-with: Cursor
2026-02-28 18:43:09 +08:00

34 lines
1.2 KiB
Markdown
Raw Permalink 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.
# SRDE Risk Control Mini Program
微信小程序风控前端,对接 SRDE 后端 API。
## 运行方式
1. 安装 [微信开发者工具](https://developers.weixin.qq.com/miniprogram/dev/devtools/download.html)
2. 打开项目:选择 `srde/miniprogram` 目录
3. 使用「测试号」或填写 AppID 后预览
## 对接真实后端
1. 修改 `services/api.ts`
- 设置 `USE_MOCK = false`
- 设置 `BASE_URL = 'https://your-api.com'`(你的后端地址)
2. 登录流程:
- 后端需提供 `POST /auth/login`,返回 `{ access_token }`
- 小程序将 token 存入 `wx.setStorageSync('srde_token', token)`
- 后续请求自动携带 `Authorization: Bearer {token}`
3. API 映射(后端需实现):
- `GET /account/status` → 账户状态
- `POST /account/capital` → 设置资金
- `POST /trade/create` → 创建交易
- `POST /trade/{id}/close` → 关闭交易
- `GET /trade/` → 交易列表
- `POST /review/{id}``GET /review/{id}` → 复盘
- `GET /statistics` → 统计数据(胜率、盈亏比等)
## 模拟模式
默认 `USE_MOCK = true`,使用本地模拟数据,不依赖后端即可完整浏览流程。