cms/dingdingflow/wwwroot/api/dd_approval_configs_update.dspy
yumoqing 5cfb0e867b feat: 开元云科技官网CMS系统初始版本
entcms模块:
- 4个数据表(cms_content/cms_categories/cms_leads/cms_site_config)
- 22个.dspy API(含公开API和data_filter)
- 4个公开页面(首页/新闻/案例)+管理后台
- 完整营销站点CSS/JS(暗色主题/渐变/动画/响应式)
- 云宝SVG线稿占位符
- RBAC权限配置

dingdingflow模块:
- 2个数据表(dd_approvals/dd_approval_configs)
- 10个.dspy API(含钉钉回调endpoint)
- 钉钉API客户端(环境变量配置,开发模式mock)
- 管理UI

文档: 架构设计/53条测试用例/开发日志
2026-05-27 15:44:26 +08:00

37 lines
1.5 KiB
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""dd_approval_configs update API"""
result = {'widgettype': 'Message', 'options': {'title': 'Error', 'message': 'Invalid request', 'type': 'error'}}
try:
record_id = params_kw.get('id', '')
if not record_id:
result['options'] = {'title': 'Error', 'message': 'ID is required', 'type': 'error'}
else:
dbname = get_module_dbname('dingdingflow')
async with DBPools().sqlorContext(dbname) as sor:
update_fields = []
update_ns = {'id': record_id}
for field in ['biz_type', 'biz_type_title', 'process_code', 'agent_id', 'form_config', 'is_active']:
val = params_kw.get(field)
if val is not None:
update_fields.append(f"{field}=${field}$")
update_ns[field] = val
# Always update updated_at
now_str = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
update_fields.append("updated_at=${updated_at}$")
update_ns['updated_at'] = now_str
if update_fields:
set_clause = ", ".join(update_fields)
await sor.sqlExe(f"UPDATE dd_approval_configs SET {set_clause} WHERE id=${id}$", update_ns)
result = {'widgettype': 'Message', 'options': {'title': 'Success', 'message': '审批配置更新成功', 'type': 'success'}}
except Exception as e:
result['options'] = {'title': 'Error', 'message': f'更新失败: {str(e)}', 'type': 'error'}
return json.dumps(result, ensure_ascii=False)