88c37e50b2
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
3.7 KiB
3.7 KiB
PBootCMS GeoPublisher 安装说明
1. 放置文件
把本目录中的整个 apps 目录复制到客户 PBootCMS 网站根目录:
{PBootCMS_ROOT}/apps
最终应存在:
{PBootCMS_ROOT}/apps/api/controller/GeoPublisherController.php
{PBootCMS_ROOT}/apps/api/controller/AiseoController.php
这个文件只依赖 PBootCMS 原生 core\basic\Controller、core\basic\Model、ay_content、ay_content_sort、ay_model,不需要改后台代码,也不需要安装额外数据库表。
2. 开启 PBootCMS API
登录 PBootCMS 后台:
全局配置 -> 配置参数 -> API
开启:
api_open = 1
api_auth = 1
api_appid = 自定义 AppID
api_secret = 自定义密钥
Geo SaaS 绑定站点时填写:
CMS 类型:PBootCMS
网站域名:https://www.example.com
AppID:后台 api_appid
Secret:后台 api_secret
3. 签名规则
每次请求都带:
appid={api_appid}
timestamp={当前 Unix 秒级时间戳}
signature=md5(md5(appid + api_secret + timestamp))
示例:
$signature = md5(md5($appid . $secret . $timestamp));
插件默认允许 300 秒时间差,便于 SaaS 服务器和客户服务器存在轻微时钟偏差。
4. 连通性测试
推荐入口:
curl "https://www.example.com/api.php?p=/GeoPublisher/ping&appid=APPID×tamp=TIMESTAMP&signature=SIGNATURE"
如果站点 rewrite 已启用,也支持:
curl "https://www.example.com/api/GeoPublisher/ping?appid=APPID×tamp=TIMESTAMP&signature=SIGNATURE"
成功返回:
{
"code": 1,
"data": {
"cms_type": "pbootcms",
"plugin_version": "1.0.0",
"site_url": "https://www.example.com"
},
"msg": ""
}
5. 栏目同步
默认同步 PBootCMS 文章模型 mcode=2 的可用栏目:
curl "https://www.example.com/api.php?p=/GeoPublisher/categories&appid=APPID×tamp=TIMESTAMP&signature=SIGNATURE&mcode=2"
兼容旧插件参数:
model_hash=2
6. 发布文章
推荐使用 POST JSON:
curl -X POST "https://www.example.com/api/GeoPublisher/publish?appid=APPID×tamp=TIMESTAMP&signature=SIGNATURE" \
-H "Content-Type: application/json" \
-d '{
"scode": "5",
"title": "企业新闻标题",
"content": "<p>正文内容</p>",
"keywords": "关键词1,关键词2",
"description": "摘要",
"author": "Geo SaaS",
"source": "企业官网",
"status": 1
}'
核心字段:
scode/category_id PBootCMS 栏目编码,必填
title 标题,必填
content HTML 正文,必填
status 1 发布,0 草稿
ico 缩略图,支持远程 URL 自动下载
pics 多图,支持逗号字符串或数组
date 发布时间,支持 Unix 时间戳或日期字符串
filename 自定义 URL 名称,可选
tags/keywords/description 可选
文章正文中的远程图片、封面 ico、多图 pics 会先下载到 PBootCMS 本地:
/static/upload/image/YYYYMMDD/geo_*.jpg
如果图片下载或保存失败,接口会返回失败,不会把 SaaS 平台图片链接写进 PBootCMS 正文。
7. 更新与状态
POST /api.php?p=/GeoPublisher/update
GET /api.php?p=/GeoPublisher/status&id={content_id}
更新接口字段和发布接口一致,额外必填:
id = PBootCMS 内容 ID
8. 旧插件兼容接口
插件保留:
/api.php?p=/GeoPublisher/categoryLists
/api.php?p=/GeoPublisher/articleAdd
/api.php?p=/Aiseo/categoryLists
/api.php?p=/Aiseo/articleAdd
用于兼容历史 AiseoController.php 风格调用。新 SaaS 侧建议统一使用:
ping / categories / publish / update / status