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: 正确模式
17 lines
474 B
Plaintext
17 lines
474 B
Plaintext
|
|
config = getConfig('.')
|
|
DBPools(config.databases)
|
|
dbname = get_module_dbname('entcms')
|
|
async with db.sqlorContext(dbname) as sor:
|
|
|
|
_id = params_kw.get('id', '')
|
|
if not _id:
|
|
return {'status': 'error', 'message': '缺少ID'}
|
|
else:
|
|
ns = {'id': _id}
|
|
rows = await sor.R('cms_content', ns)
|
|
if rows:
|
|
return {'status': 'ok', 'data': rows[0]}
|
|
else:
|
|
return {'status': 'error', 'message': '内容不存在'}
|