feat: 新增客片案例与团队共创模块,重构玩法与配置
- 新增客片案例全流程功能,包含前台页面、管理端配置、后端API、数据库迁移与文档 - 新增团队共创详情页面与对应接口 - 重构玩法模块:将静态playData替换为动态API获取,拆分类型定义到playTypes.ts - 优化vite构建配置与环境变量处理,调整详情页操作栏文案 - 更新全量相关文档与配图,新增客片案例、团队共创API文档 - 新增测试用例,完善数据归一化逻辑 - 调整路由配置与环境变量示例文件
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# WonderQ MiniAPP Public API
|
||||
|
||||
本文档是 `WonderQ-MiniAPP` 当前使用的 Public API 契约。接口只提供站点内容、登录和出行需求提交能力。
|
||||
本文档是 `WonderQ-MiniAPP` 当前使用的 Public API 契约。接口提供站点内容、首页卡片、玩法展示、管家展示、登录和出行需求提交能力。
|
||||
|
||||
## 基础约定
|
||||
|
||||
@@ -15,6 +15,12 @@
|
||||
| ------ | ------------------------------ | ------------ | ------------------ |
|
||||
| `GET` | `/health` | 否 | 服务健康检查 |
|
||||
| `GET` | `/api/public/site-config` | 否 | 获取启用的站点内容 |
|
||||
| `GET` | `/api/public/home` | 否 | 获取已启用的首页内容和玩法推荐 |
|
||||
| `GET` | `/api/public/home/team-buildings/{teamBuildingId}` | 否 | 获取团队共创详情 |
|
||||
| `GET` | `/api/public/home/wild-archives` | 否 | 获取客片案例更多列表 |
|
||||
| `GET` | `/api/public/home/wild-archives/{archiveId}` | 否 | 获取客片案例详情和图片 |
|
||||
| `GET` | `/api/public/wanfa/categories` | 否 | 获取玩法分类和路线 |
|
||||
| `GET` | `/api/public/concierge/advisors` | 否 | 获取已启用的管家顾问 |
|
||||
| `POST` | `/api/public/auth/phone-login` | 否 | 微信手机号登录 |
|
||||
| `GET` | `/api/public/auth/me` | Customer JWT | 获取当前客户 |
|
||||
| `POST` | `/api/public/leads` | 否 | 提交出行需求 |
|
||||
@@ -36,6 +42,153 @@ type SiteConfig = {
|
||||
|
||||
Public 响应只返回启用内容,其余模块按 `isActive` 过滤。
|
||||
|
||||
## 玩法展示
|
||||
|
||||
### `GET /api/public/wanfa/categories`
|
||||
|
||||
无需鉴权。接口按后台维护的分类和路线顺序返回 MiniAPP 玩法页所需的最小展示字段,不返回后台排序、审计和时间字段。
|
||||
|
||||
成功响应:
|
||||
|
||||
```ts
|
||||
type PublicWanfaResponse = {
|
||||
categories: PublicWanfaCategory[];
|
||||
};
|
||||
|
||||
type PublicWanfaCategory = {
|
||||
id: string;
|
||||
label: string;
|
||||
routes: PublicWanfaRoute[];
|
||||
};
|
||||
|
||||
type PublicWanfaRoute = {
|
||||
id: string;
|
||||
title: string;
|
||||
subtitle: string;
|
||||
image: string;
|
||||
routeCount: number;
|
||||
demandKeyword: string;
|
||||
};
|
||||
```
|
||||
|
||||
MiniAPP 使用 `demandKeyword` 作为需求页预填关键词;接口失败或响应为空时,玩法页展示对应的错误、重试或空态,不再读取 `playData.ts` 模拟数据。
|
||||
|
||||
## 管家展示
|
||||
|
||||
### `GET /api/public/concierge/advisors`
|
||||
|
||||
无需鉴权。接口只返回后台启用的管家顾问,按后台维护顺序返回;不返回管理端 ID、启停状态、排序元数据和时间字段。
|
||||
|
||||
```ts
|
||||
type PublicConciergeDetail = {
|
||||
icon: string;
|
||||
label: string;
|
||||
};
|
||||
|
||||
type PublicConciergeAdvisor = {
|
||||
avatar: string;
|
||||
name: string;
|
||||
role: string;
|
||||
details: PublicConciergeDetail[];
|
||||
qrImage: string;
|
||||
};
|
||||
|
||||
type PublicConciergeResponse = {
|
||||
advisors: PublicConciergeAdvisor[];
|
||||
};
|
||||
```
|
||||
|
||||
成功响应示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"advisors": [
|
||||
{
|
||||
"avatar": "https://example.test/assets/advisor-avatar.jpg",
|
||||
"name": "示例顾问",
|
||||
"role": "SENIOR TRAVEL ADVISOR",
|
||||
"details": [{ "icon": "calendar", "label": "服务经验:8年" }],
|
||||
"qrImage": "https://example.test/assets/advisor-qr.png"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
无可用顾问时返回 `{ "advisors": [] }`。MiniAPP 应处理 loading、错误、重试和空态,不能依赖固定顾问姓名或本地模拟数组。
|
||||
|
||||
## 首页内容
|
||||
|
||||
### `GET /api/public/home`
|
||||
|
||||
无需鉴权。接口只返回后台启用的首页体验推荐、团队共创和极境视界内容,按后台排序返回,不暴露管理元数据。
|
||||
|
||||
```ts
|
||||
type PublicHomeResponse = {
|
||||
experiences: HomeExperience[];
|
||||
teamBuildings: HomeTeamBuilding[];
|
||||
wildArchives: HomeWildArchive[];
|
||||
playRecommendations: HomeWanfaRecommendation[];
|
||||
};
|
||||
|
||||
type HomeWanfaRecommendation = {
|
||||
id: string;
|
||||
categoryId: string;
|
||||
label: string;
|
||||
routes: WanfaRoute[];
|
||||
};
|
||||
|
||||
type WanfaRoute = {
|
||||
id: string;
|
||||
title: string;
|
||||
subtitle: string;
|
||||
image: string;
|
||||
routeCount: number;
|
||||
demandKeyword: string;
|
||||
};
|
||||
|
||||
type HomeExperience = {
|
||||
id: string;
|
||||
badge: string;
|
||||
category: string;
|
||||
title: string;
|
||||
englishTitle: string;
|
||||
image: string;
|
||||
demandKeyword: string;
|
||||
};
|
||||
|
||||
type HomeTeamBuilding = {
|
||||
id: string;
|
||||
tag: string;
|
||||
title: string;
|
||||
description: string;
|
||||
image: string;
|
||||
demandKeyword: string;
|
||||
};
|
||||
|
||||
type PublicHomeTeamBuildingDetail = HomeTeamBuilding & {
|
||||
detailSubtitle: string;
|
||||
detailParagraphs: string[];
|
||||
};
|
||||
|
||||
type HomeWildArchive = {
|
||||
id: string;
|
||||
title: string;
|
||||
image: string;
|
||||
demandKeyword: string;
|
||||
photoCount: number;
|
||||
};
|
||||
```
|
||||
|
||||
无可用内容时,`experiences`、`teamBuildings`、`wildArchives` 和 `playRecommendations` 均返回空数组。玩法推荐由首页内容域关联玩法分类后生成,接口只返回启用的关联及分类当前路线;MiniAPP 接口失败或字段不完整时使用首页对应 fallback,玩法推荐缺省为空态。
|
||||
|
||||
客片案例更多列表使用 `GET /api/public/home/wild-archives`,返回同样的摘要字段;详情使用 `GET /api/public/home/wild-archives/{archiveId}`,在摘要字段基础上增加 `images: string[]`。首页卡片点击详情,`查看更多` 点击案例列表,不再跳转需求页。
|
||||
|
||||
### 团队共创详情
|
||||
|
||||
`GET /api/public/home/team-buildings/{teamBuildingId}` 无需鉴权,只返回启用的团队共创详情。响应包含首页摘要字段,以及 `detailSubtitle` 和 `detailParagraphs`。不存在或已停用返回 `404`。
|
||||
|
||||
详情页接口失败时,MiniAPP 按 ID 使用 `homeTeamBuildingData.ts` 中的网络图片和模拟正文 fallback,并显示接口不可用提示;首页 `/api/public/home` 不返回 `detailParagraphs`,避免首页请求携带长正文。
|
||||
|
||||
### 通用字段
|
||||
|
||||
站点模块通常包含 `id`、`createdAt`、`updatedAt`、`isActive` 和 `sortOrder`。客户端按 `sortOrder` 消费排序模块,不依赖固定 ID。
|
||||
|
||||
Reference in New Issue
Block a user