Files
geo/docs/enterprise-site-publisher-v1.md
root 88c37e50b2
Frontend CI / Frontend (push) Successful in 3m57s
Backend CI / Backend (push) Failing after 6m43s
feat(enterprise-site): add PbootCMS enterprise site publisher
Introduce a new enterprise-site publishing channel that lets tenants push
articles to self-hosted PbootCMS sites alongside the existing media supply
flow.

Backend (server/internal/tenant):
- enterprise_site_service: CRUD, ping, category sync, and article publish
- enterprise_site_pbootcms: PbootCMS API client integration
- enterprise_site_crypto: encrypt/decrypt stored site credentials
- enterprise_site_handler + routes under /enterprise-sites
- migrations for the enterprise site publisher tables
- config: add SERVER_PUBLIC_BASE_URL (Server.PublicBaseURL) for callbacks
- article/media services adjusted to support the publish flow

Frontend (apps/admin-web):
- PublishArticleModal & ArticlePublishStatus: enterprise-site publish UI
- MediaView: manage enterprise sites and categories
- api + shared-types: enterprise site endpoints and types
- http-client: add PATCH method support

Integrations:
- pbootcms GeoPublisher controller plugin + install guide
- docs/enterprise-site-publisher-v1.md design doc
2026-06-06 13:06:14 +08:00

4.5 KiB
Raw Permalink Blame History

企业自建站点自动发文系统 v1

定位

企业自建站点不是 UGC 媒体账号,也不应该走桌面客户端登录态。它是客户自有 CMS 的站点连接,由 Geo SaaS 服务端通过 CMS 适配器直接调用发布接口。

媒体管理建议分三类:

UGC媒体平台      走桌面客户端账号授权和发布队列
第三方新闻源      走资源/订单/投稿线索
企业自建站点      走 CMS 连接、栏目同步、服务端发布

核心模型

建议新增站点连接表:

enterprise_site_connections

关键字段:

id
tenant_id
name
site_url
cms_type              pbootcms / wordpress / dedecms / phpcms
auth_type             native_api / application_password / plugin_token
credential_ref        凭证密文或凭证引用
status                draft / connected / error / disabled
last_ping_at
last_sync_at
last_error
created_at
updated_at

栏目缓存表:

enterprise_site_categories

关键字段:

id
tenant_id
connection_id
remote_id
parent_remote_id
name
slug
raw_payload
synced_at

发布记录可复用现有发布记录体系,也可以增加 target_type=enterprise_sitetarget_connection_id。不要把企业站点伪装成 platform_account,否则后续 WordPress、PBootCMS 插件、DedeCMS 插件会和桌面端账号模型缠在一起。

统一适配器协议

所有 CMS 适配器都实现:

ping(connection) -> SiteCapability
categories(connection, options) -> Category[]
publish(connection, article, options) -> PublishResult
update(connection, remoteId, article, options) -> PublishResult
status(connection, remoteId) -> RemoteContentStatus

返回结构:

SiteCapability:
  cms_type
  plugin_version
  site_url
  site_name
  api_auth

Category:
  id
  parent_id
  title
  slug
  raw

PublishResult:
  remote_id
  url
  status
  raw

RemoteContentStatus:
  remote_id
  title
  status
  url
  updated_at

PBootCMS v1

集成方式:站点放置单文件插件。

插件路径:

integrations/pbootcms/apps/api/controller/GeoPublisherController.php

客户站点安装到:

apps/api/controller/GeoPublisherController.php

接口:

GET  /api/GeoPublisher/ping
GET  /api/GeoPublisher/categories
POST /api/GeoPublisher/publish
POST /api/GeoPublisher/update
GET  /api/GeoPublisher/status

鉴权使用 PBootCMS 原生 API 参数:

appid
timestamp
signature = md5(md5(appid + api_secret + timestamp))

适配器保存:

site_url
appid
api_secret
default_acode
default_mcode

WordPress v1

优先使用 WordPress REST API 和 Application Password

GET  /wp-json/
GET  /wp-json/wp/v2/categories
POST /wp-json/wp/v2/posts
POST /wp-json/wp/v2/posts/{id}
GET  /wp-json/wp/v2/posts/{id}

鉴权:

Basic base64(username:application_password)

WordPress 不需要客户安装插件即可完成基础发文;如果后续要支持自定义字段、SEO 插件字段、图片本地化、内链策略,再提供 WordPress 插件增强。

DedeCMS / PHPCMS v1

建议走与 PBootCMS 相同的单文件插件协议,不直接侵入后台登录。

原因:

老版本安全差异大
后台路径常被改名
字段模型定制多
原生 API 能力不统一

插件统一暴露:

ping / categories / publish / update / status

SaaS 侧只新增 cms_type 适配器,不改发布业务协议。

发布链路

文章生成完成
选择发布目标:企业自建站点
读取 connection + category mapping
服务端调用 CmsPublisherAdapter.publish
保存 remote_id/url/raw response
同步状态和错误

失败重试策略:

网络超时:可重试
401/403:标记连接异常,要求重新绑定
栏目不存在:停止重试,要求重新同步栏目
CMS 返回字段错误:停止重试,记录原始响应

安全要求

凭证不得明文回显给前端
日志不得打印 api_secret/application_password/plugin_token
发布接口只允许 HTTPS 站点进入生产发布
支持手动禁用连接
记录每次 ping/sync/publish 的错误摘要和时间

后台页面 v1

媒体管理页新增 企业自建站点 标签。

首版页面应提供:

站点连接列表
CMS 类型
连通状态
栏目同步时间
最近发布结果
安装插件入口
新增连接入口

在后端 API 完成前,前端可以先展示结构化空态和接入流程,但路由/术语要按最终模型命名,避免后续返工。