chore: remove wechat remnants

This commit is contained in:
2026-01-17 21:06:02 +08:00
parent 1419bd9bd0
commit 79146434a8
18 changed files with 46 additions and 114 deletions

View File

@@ -8,11 +8,11 @@
- 租户前缀:`/t/:tenant_code/`(不区分大小写;服务端统一按 `lower()` 识别)
- API`/t/:tenant_code/v1/...`
- Admin SPA`/t/:tenant_code/admin/...`
- WeChat SPA`/t/:tenant_code/...`(除 `v1``admin` 子路径)
- Portal SPA`/t/:tenant_code/...`(除 `v1``admin` 子路径)
### 1.2 为什么必须这样分层
- WeChat/后台前端都是 SPA通常需要一个 catch-all 回退到 `index.html`
- Portal/后台前端都是 SPA通常需要一个 catch-all 回退到 `index.html`
- 同时 API 又需要精确匹配,必须确保 API 路由优先于静态路由
---
@@ -23,7 +23,7 @@
1) `GET /t/:tenant_code/v1/...`:注册所有 API并注入 TenantContext 中间件)
2) `GET /t/:tenant_code/admin*`:回退到 Admin 的 `index.html`(并正确设置静态资源 base
3) `GET /t/:tenant_code/*`:回退到 WeChat`index.html`
3) `GET /t/:tenant_code/*`:回退到 Portal`index.html`
> 重点:不要用全局 `GET /*` 直接接管,否则会吞掉 API 与 admin。
@@ -46,7 +46,7 @@
---
## 4. 前端(WeChat H5
## 4. 前端(Portal 用户端
### 4.1 Router base
@@ -55,13 +55,12 @@
### 4.2 API baseURL 与 Cookie
- axios `baseURL = "/t/<tenant_code>/v1"`
- `withCredentials = true`(历史 WeChat 方案)
- 当前实现改为 JWT`Authorization: Bearer <token>`
- 当前实现使用 JWT`Authorization: Bearer <token>`
### 4.3 未登录跳转
- 401 时跳:`/t/<tenant_code>/v1/auth/wechat?redirect=<encodeURIComponent(currentUrl)>`
- 当前实现为 OTP 登录,不走微信授权回调
- 401 时跳:`/t/<tenant_code>/auth/login?redirect=<encodeURIComponent(currentUrl)>`
- 当前实现为 OTP 登录,无第三方授权回调
---