From 11fb1a6c9ba7f649da4ce20ecde482276776efda Mon Sep 17 00:00:00 2001 From: API Changelog Bot Date: Mon, 25 May 2026 10:40:14 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=AF=84=E4=BB=B7):=20admin/mp=20?= =?UTF-8?q?=E8=AF=84=E4=BB=B7=E6=8E=A5=E5=8F=A3=E5=8A=A0=20source=20?= =?UTF-8?q?=E6=9D=A5=E6=BA=90=E5=AD=97=E6=AE=B5=20(HL=20#2978/PR=20#2981)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - admin /admin/review/list 加 source/sourceLabel + source 筛选入参 - mp /mp/review/target & /product/{id} 加 source/sourceLabel - 枚举 MINIPROGRAM(小程序) / YOUZAN(有赞) - 小程序创建评价后端写死 MINIPROGRAM - 有赞数据本期不做导入接口,wx 自行 INSERT --- .../2026-05/25_feat_review_source_field.md | 117 ++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 changelogs/2026-05/25_feat_review_source_field.md diff --git a/changelogs/2026-05/25_feat_review_source_field.md b/changelogs/2026-05/25_feat_review_source_field.md new file mode 100644 index 0000000..6cacf91 --- /dev/null +++ b/changelogs/2026-05/25_feat_review_source_field.md @@ -0,0 +1,117 @@ +# feat(评价): 评价列表/审核 admin 端新增「来源」列 + 筛选; 小程序评价 VO 新增 source 字段 + +> **类型**: feat (后端 + 前端均需改动) +> **关联 PR/Issue**: PR #2981 (Closes #2978) 已合 dev,测试服已部署 + API 真测通过 +> **日期**: 2026-05-25 +> **影响范围**: admin 端「评价审核」列表(`/admin/review/list`) + 小程序评价查询接口(`/mp/review/*`) +> **接收方**: mmg +> **前端**: **admin 端需要改造**(新增「来源」列 + 筛选下拉);小程序端按需展示 + +--- + +## 🎯 背景 + +业务侧需要区分评价的来源渠道。本期场景: + +- **MINIPROGRAM = 小程序**:客人在小程序提交的评价(已有的全部历史数据,新增评价默认这个) +- **YOUZAN = 有赞**:从有赞平台导入的评价(本期不做导入接口,wx 自行 INSERT/批量导入) + +后端字段已就绪,管理端展示 + 筛选需要前端配合。 + +--- + +## 📊 admin 端 `/admin/review/list` 改动 + +### 1. 响应每条评价新增 2 个字段 + +```diff +{ + "reviewId": 2058729444025028610, + "status": "APPROVED", + ..., ++ "source": "MINIPROGRAM", // 评价来源 code ++ "sourceLabel": "小程序" // 评价来源中文 +} +``` + +枚举值: + +| source | sourceLabel | +|--------|-------------| +| MINIPROGRAM | 小程序 | +| YOUZAN | 有赞 | + +### 2. 请求新增筛选入参 `source`(可选) + +``` +GET /admin/review/list?pageNo=1&pageSize=20&source=YOUZAN +GET /admin/review/list?pageNo=1&pageSize=20&source=MINIPROGRAM +``` + +不传 = 不按来源筛选(返回全部)。 + +### 3. 前端期望改造 + +- 列表表头加一列「来源」,内容直接渲染 `sourceLabel`(已是中文,无需前端再映射) +- 筛选区(截图中现有「评价状态 / 评价等级 / 图片/视频」那一行)加一个「来源」下拉,选项: + - 全部 (不传 source) + - 小程序 (source=MINIPROGRAM) + - 有赞 (source=YOUZAN) + +--- + +## 📊 小程序 `/mp/review/*` 改动 + +### 受影响接口 + +- `GET /mp/review/target?targetType=PRODUCT&targetId=...` +- `GET /mp/review/product/{productId}` + +### 响应每条评价新增 2 个字段(同 admin) + +```diff +{ + "reviewId": 2031394849190555650, + "userNickname": "xxx", + ..., ++ "source": "MINIPROGRAM", ++ "sourceLabel": "小程序" +} +``` + +### 前端期望 + +小程序端**是否展示**「来源」标识由 mmg 决定。如果展示,直接渲染 `sourceLabel`(有赞评价可加角标区分)。 + +--- + +## 🔬 业务规则 + +1. **小程序新建评价 `POST /mp/review/create`** → 后端自动写入 `source=MINIPROGRAM`,前端不需要传 +2. **有赞评价**本期不做导入接口,wx 自行 INSERT(`INSERT INTO order_review (..., source) VALUES (..., 'YOUZAN')`) +3. 历史所有评价已回填 `source=MINIPROGRAM` + +--- + +## ✅ 后端验证记录 + +### 本地 (gateway 8080) + +``` +POST /admin/auth/login → 200, token len=259 +GET /admin/review/list?pageNo=1&pageSize=2 → source/sourceLabel 字段就位 +GET /admin/review/list?source=YOUZAN → total=1 (手动 UPDATE 1 条测试) +GET /admin/review/list?source=MINIPROGRAM → total=446 +GET /mp/review/target?targetType=PRODUCT... → source/sourceLabel 透传 OK +``` + +### 测试服 (api.test.1814.love:9443) + +``` +POST /admin/auth/login → 200 +GET /admin/review/list?pageNo=1&pageSize=2 → source=MINIPROGRAM sourceLabel=小程序 ✓ +GET /admin/review/list?source=YOUZAN → total=0 (干净, 等 wx 导入) +GET /mp/review/target?targetType=PRODUCT... → source=MINIPROGRAM sourceLabel=小程序 ✓ +``` + +Flyway `V20260525_001__add_source_to_order_review.sql` 已落库,`source VARCHAR(32) NOT NULL DEFAULT 'MINIPROGRAM'` + `idx_source` 索引。