world/wwwroot/api/get_search_status.dspy

14 lines
637 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""世界模式下拉数据源world_mode 编码字典):返回 [{value, text}],首项为"全部"。"""
result = [{'value': '', 'text': '全部'}]
try:
dbname = get_module_dbname('world')
async with DBPools().sqlorContext(dbname) as sor:
rows = await sor.sqlExe(
'SELECT k AS value, v AS text FROM appcodes_kv WHERE parentid = ${pid}$ ORDER BY id',
{'pid': 'world_mode'},
)
result = result + [{'value': r['value'], 'text': r['text']} for r in (rows or [])]
except Exception as e:
exception('get_search_status.dspy: %s' % e)
return json.dumps(result, ensure_ascii=False)