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: 正确模式
19 lines
601 B
Plaintext
19 lines
601 B
Plaintext
|
|
config = getConfig('.')
|
|
DBPools(config.databases)
|
|
dbname = get_module_dbname('entcms')
|
|
async with db.sqlorContext(dbname) as sor:
|
|
|
|
ns = {'is_visible': '1', 'sort': 'sort_order asc'}
|
|
rows = await sor.R('cms_sections', ns)
|
|
# Parse JSON fields
|
|
for r in rows:
|
|
for field in ['display_config', 'style_config', 'static_content']:
|
|
v = r.get(field, None)
|
|
if v and isinstance(v, str):
|
|
try:
|
|
r[field] = json.loads(v)
|
|
except:
|
|
pass
|
|
return {'status': 'ok', 'rows': rows, 'total': len(rows)}
|