docs: design bilingual enterprise news APIs

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
ping 2026-07-29 15:43:04 +08:00
parent 1de17afa1c
commit 09449c8a4b

View File

@ -0,0 +1,37 @@
# 中英文企业动态接口设计
## 目标
企业文章支持运营同时录入中文和英文内容。接口直接使用
`enterprise_news_article` 表中的中英文字段,不再读写旧字段
`title``article_type``summary``content`
## 字段
- 中文:`title_zh``article_type_zh``summary_zh``content_zh`
- 英文:`title_en``article_type_en``summary_en``content_en`
- 共用:`cover_img``status``publish_time``read_count`
新增文章仅要求 `title_zh` 必填,其余中英文字段允许为空。
## 接口调整
- `news_article_add.dspy`:接收并写入全部中英文字段。
- `news_article_update.dspy`:按传入字段更新中英文内容。
- `news_article_search.dspy`:支持中英文标题和类型筛选,返回全部中英文字段;类型汇总分别使用中英文类型。
- `news_article_detail.dspy`:返回全部中英文字段。
- `front_news_search.dspy`:支持中英文标题和类型筛选,返回全部中英文字段。
- `front_news_detail.dspy`:返回全部中英文字段,并保持阅读量加一。
发布、下架、删除接口不涉及语言字段,不调整。
## 兼容边界
旧字段已由数据库移除非空约束,本次接口不再维护旧字段。调用方需要改为传入和读取中英文新字段。
## 验证
- 新增时缺少 `title_zh` 返回校验错误。
- 新增、更新后详情能完整返回中英文字段。
- 后台和前端列表能按中英文标题、类型筛选。
- 前端详情仍仅允许读取已发布文章,并正确增加阅读量。