dspy文件修复(27个entcms + 10个dingdingflow): - 删除所有import语句(dspy环境已预加载) - 替换 sor = DBPools().sqlorContext() 为 async with db.sqlorContext() as sor: - 替换 print(json.dumps()) 为 return - 替换 uuid() 为 getID() - 替换 datetime.datetime.now() 为 datetime.now() - 修复 get_user() 缺少 await - 删除shebang/docstrings等无关内容 - 修正缩进 Python模块修复: - entcms/init.py: DBNAME从'entcms'改为'ocai_cms' - app/global_func.py: get_module_dbname返回'ocai_cms'而非'sage' - 所有函数使用 async with db.sqlorContext() as sor: 正确模式
30 lines
1.0 KiB
Plaintext
30 lines
1.0 KiB
Plaintext
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 = (await 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 result
|