- 将 entcms/wwwroot/* 移到 wwwroot/ - 将 dingdingflow/wwwroot/* 移到 wwwroot/dingdingflow/ - 更新 config.json 使用单一 wwwroot 映射 - 更新 init_any_permissions.py 扫描新路径 - 更新 init_superuser_permissions.py 用法说明 - 废弃 entcms/scripts/load_path.py 和 dingdingflow/scripts/load_path.py - 更新 build.sh 构建步骤 - 更新 README.md 和 docs/architecture.md 目录说明
37 lines
1.3 KiB
Python
37 lines
1.3 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
"""
|
|
Submit approval API - triggered by entcms when content needs approval.
|
|
Creates a dd_approvals record and calls DingTalk API to start the approval process.
|
|
"""
|
|
|
|
result = {'success': False, 'message': 'Invalid request'}
|
|
|
|
try:
|
|
biz_type = params_kw.get('biz_type', '')
|
|
biz_id = params_kw.get('biz_id', '')
|
|
title = params_kw.get('title', '')
|
|
applicant_id = params_kw.get('applicant_id', '')
|
|
|
|
if not biz_type:
|
|
result = {'success': False, 'message': 'biz_type is required'}
|
|
elif not biz_id:
|
|
result = {'success': False, 'message': 'biz_id is required'}
|
|
elif not title:
|
|
result = {'success': False, 'message': 'title is required'}
|
|
else:
|
|
# Use current user as applicant if not specified
|
|
if not applicant_id:
|
|
applicant_id = get_user() or ''
|
|
|
|
org_id = (await get_userorgid()) or '0'
|
|
|
|
# Call the submit_approval function registered via load_dingdingflow()
|
|
approval_result = await submit_approval(biz_type, biz_id, title, applicant_id, org_id)
|
|
result = approval_result
|
|
|
|
except Exception as e:
|
|
result = {'success': False, 'message': f'提交审批失败: {str(e)}'}
|
|
|
|
return json.dumps(result, ensure_ascii=False, default=str)
|