- cms/: Python包(合并原entcms+dingdingflow) - init.py: 791行,load_cms()注册所有CRUD+审批函数 - dingtalk_client.py: 钉钉API客户端 - models/: 7个表定义JSON(5个CMS+2个DD) - json/: 7个CRUD定义JSON - wwwroot/: 管理后台CRUD页面和API(37个dspy) - init/data.yaml: 模块初始数据(appcodes/appcodes_kv/分类/栏目/配置) - scripts/load_path.py: RBAC权限配置 - pyproject.toml: pip-installable包定义 - 删除: app/, conf/, build.sh, entcms/, dingdingflow/等webapp文件 - 数据库访问统一为DBPools()+_get_dbname()动态模式
34 lines
983 B
Plaintext
34 lines
983 B
Plaintext
|
|
config = getConfig('.')
|
|
DBPools(config.databases)
|
|
dbname = get_module_dbname('cms')
|
|
async with db.sqlorContext(dbname) as sor:
|
|
|
|
ns = {'sort': 'sort_order asc, created_at desc'}
|
|
|
|
# data_filter support
|
|
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
|
|
|
|
# Manual filter params
|
|
_content_type = params_kw.get('content_type', None)
|
|
if _content_type:
|
|
ns['content_type'] = _content_type
|
|
|
|
_status = params_kw.get('status', None)
|
|
if _status:
|
|
ns['status'] = _status
|
|
|
|
rows = await sor.R('cms_content', ns)
|
|
total = len(rows)
|
|
return {'status': 'ok', 'rows': rows, 'total': total}
|