kboss/docs/superpowers/specs/2026-07-29-bilingual-enterprise-news-design.md
ping 15079ad730 docs: extend bilingual news media fields
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-29 16:55:37 +08:00

2.1 KiB

中英文企业动态接口设计

目标

企业文章支持运营同时录入中文和英文内容。接口直接使用 enterprise_news_article 表中的中英文字段,不再读写旧字段 titlearticle_typesummarycontent

字段

  • 中文:title_zharticle_type_zhsummary_zhcontent_zh
  • 英文:title_enarticle_type_ensummary_encontent_en
  • 中文扩展:cover_img_zhpublish_time_zh
  • 英文扩展:cover_img_enpublish_time_en
  • 共用:statusread_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:返回全部中英文字段,并保持阅读量加一。
  • news_article_publish.dspy:支持分别设置中英文发布时间,未传时均默认当天。

下架、删除接口不涉及语言字段,不调整。

兼容边界

旧字段已由数据库移除非空约束,本次接口不再维护旧字段。调用方需要改为传入和读取中英文新字段。 旧字段 cover_imgpublish_time 同样不再读写。列表按两个发布时间中的较晚日期倒序排列,再按更新时间倒序排列。

验证

  • 新增时缺少 title_zh 返回校验错误。
  • 新增、更新后详情能完整返回中英文字段。
  • 后台和前端列表能按中英文标题、类型筛选。
  • 新增、编辑、列表和详情能分别读写中英文封面及发布时间。
  • 发布时未传中英文发布时间,两个字段均写入当天日期。
  • 前端详情仍仅允许读取已发布文章,并正确增加阅读量。