diff --git a/build.sh b/build.sh index a1e7bd3..18acd1f 100755 --- a/build.sh +++ b/build.sh @@ -191,7 +191,10 @@ echo " py3/bin/python entcms/scripts/load_path.py" echo " py3/bin/python dingdingflow/scripts/load_path.py" echo " 4. 初始化超级用户:" echo " py3/bin/python scripts/init_superuser.py" -echo " 5. 启动应用:" +echo " 5. 初始化权限:" +echo " py3/bin/python init_superuser_permissions.py" +echo " py3/bin/python init_any_permissions.py" +echo " 6. 启动应用:" echo " ./start.sh" echo "" echo "访问地址: http://localhost:9090/" diff --git a/dingdingflow/dingdingflow/init.py b/dingdingflow/dingdingflow/init.py index 624bce7..2d9f32b 100644 --- a/dingdingflow/dingdingflow/init.py +++ b/dingdingflow/dingdingflow/init.py @@ -383,14 +383,18 @@ async def handle_dingtalk_callback(data): await update_dd_approval(update_data) logger.info("Callback: approval %s updated to %s", record_id, new_status) - # TODO: Notify entcms module about status change - # This would trigger content status update in the CMS + # Notify entcms module about status change biz_type = getattr(record, "biz_type", "") biz_id = getattr(record, "biz_id", "") - logger.info( - "Callback: should notify entcms: biz_type=%s, biz_id=%s, status=%s", - biz_type, biz_id, new_status - ) + if biz_type == "content_publish" and biz_id: + content_status = "published" if new_status == "approved" else "draft" if new_status == "rejected" else "" + if content_status: + content_update = {"id": biz_id, "status": content_status} + if content_status == "published": + content_update["published_at"] = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") + async with db.sqlorContext(dbname) as sor: + await sor.U("cms_content", content_update) + logger.info("Callback: cms_content %s updated to %s", biz_id, content_status) return { "success": True, diff --git a/docs/architecture.md b/docs/architecture.md index 319ffdd..05e4d64 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -13,21 +13,24 @@ |------|------| | cms_content | 统一内容表(新闻/案例/产品/Banner),带发布审批状态流 | | cms_categories | 内容分类(支持层级,按content_type分组) | +| cms_sections | 栏目管理 | | cms_leads | 商机线索(网站访客提交 + 未来AI抽取) | | cms_site_config | 站点配置(Hero标语、页脚信息等KV配置) | **公开页面 (any权限)**: -- `/entcms/index.ui` - 官网首页(7个模块:导航/Hero/产品/案例/新闻/页脚/浮动入口) -- `/entcms/news.ui` - 新闻列表 -- `/entcms/news_detail.ui` - 新闻详情 -- `/entcms/cases.ui` - 案例列表 +- `/index.ui` - 官网首页(7个模块:导航/Hero/产品/案例/新闻/页脚/浮动入口) +- `/products.ui` - 产品架构列表 +- `/news.ui` - 新闻列表 +- `/news_detail.ui` - 新闻详情 +- `/cases.ui` - 案例列表 **管理页面 (logined权限)**: -- `/entcms/admin.ui` - 管理后台仪表盘 -- `/entcms/cms_content_list` - 内容CRUD -- `/entcms/cms_categories_list` - 分类CRUD -- `/entcms/cms_leads_list` - 线索CRUD -- `/entcms/cms_site_config_list` - 配置CRUD +- `/admin.ui` - 管理后台仪表盘 +- `/cms_content_list` - 内容CRUD +- `/cms_categories_list` - 分类CRUD +- `/cms_sections_list` - 栏目CRUD +- `/cms_leads_list` - 线索CRUD +- `/cms_site_config_list` - 配置CRUD **内容审批流程**: 编辑创建内容(草稿) → 提交审批(status=pending) → 钉钉审批 → 审批通过(status=approved) → 发布(status=published) diff --git a/entcms/wwwroot/products.ui b/entcms/wwwroot/products.ui new file mode 100644 index 0000000..a37ee16 --- /dev/null +++ b/entcms/wwwroot/products.ui @@ -0,0 +1,13 @@ +{% set products = get_published_content('product', 50) %} +{ + "widgettype": "VBox", + "options": {"width": "100%", "css": "site-root"}, + "subwidgets": [ + { + "widgettype": "Html", + "options": { + "html": "