cms/README.md
yumoqing 20602fadfb refactor: 钉钉审批独立为 dingdingflow 模块,cms 侧剔除
- 删除 cms/dingtalk_client.py、dd_approvals*/dd_approval_configs* 的 models/json/dspy(共14文件)
- cms/init.py 删钉钉段 355 行(792->450)
- submit_content_for_approval 改走 ServerEnv 软依赖调 submit_approval,
  未加载 dingdingflow 时只置 pending 不报错
- 新增 on_content_approval_done 回调钩子:原先硬编码在钉钉回调里的
  cms_content 回写逻辑归位到 cms 自己,由 load_cms() 注册到 content_publish
- load_path 移除 11 条钉钉路径;i18n 移除钉钉专属文案;README 更新依赖说明
2026-08-25 18:17:04 +08:00

64 lines
1.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# CMS 内容管理模块
企业官网内容管理模块基于Sage/bricks-framework开发。
## 功能
- **内容管理**: 新闻/案例/产品/Banner的统一CRUD带发布审批状态流
- **分类管理**: 按content_type分组的层级分类
- **栏目管理**: 官网页面栏目配置
- **商机线索**: 网站访客提交 + AI抽取
- **站点配置**: Hero标语、页脚等KV配置
- **内容审批**: 发起发布审批(审批能力由 dingdingflow 独立模块提供)
## 数据库表
| 表名 | 用途 |
|------|------|
| cms_content | 统一内容表 |
| cms_categories | 内容分类 |
| cms_sections | 栏目管理 |
| cms_leads | 商机线索 |
| cms_site_config | 站点配置 |
## 安装
```bash
pip install -e ~/repos/cms
```
## 集成
在Web应用(app/portal.py)中:
```python
from cms.init import load_cms
def init():
load_cms()
```
## 初始数据
`init/data.yaml` 包含:
- appcodes/appcodes_kv: 枚举编码(content_type, content_status, lead_status等)
- cms_categories: 默认分类
- cms_site_config: 默认站点配置
- cms_sections: 默认栏目配置
- dd_approval_configs: 默认审批配置
## 审批依赖
内容审批走 **dingdingflow** 独立模块(软依赖):
```python
from cms.init import load_cms
from dingdingflow.init import load_dingdingflow
load_dingdingflow() # 必须先加载cms 才能注册审批回调钩子
load_cms()
```
未加载 dingdingflow 时,`submit_content_for_approval` 只把内容置为 pending
并返回提示,不报错。钉钉凭据/审批模板配置见 dingdingflow 的 README。