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: 正确模式
21 lines
683 B
Plaintext
21 lines
683 B
Plaintext
|
|
config = getConfig('.')
|
|
DBPools(config.databases)
|
|
dbname = get_module_dbname('entcms')
|
|
async with db.sqlorContext(dbname) as sor:
|
|
|
|
ns = {'sort': 'sort_order asc'}
|
|
filter_json = params_kw.get('data_filter', None)
|
|
if filter_json:
|
|
from sqlor.filter import DBFilter
|
|
try:
|
|
filter_def = json.loads(filter_json) if isinstance(filter_json, str) else filter_json
|
|
dbf = DBFilter(filter_def)
|
|
conds = dbf.gen(params_kw)
|
|
ns.update(conds)
|
|
ns.update(dbf.consts)
|
|
except Exception:
|
|
pass
|
|
rows = await sor.R('cms_sections', ns)
|
|
return {'status': 'ok', 'rows': rows, 'total': len(rows)}
|