entity/wwwroot/api/get_search_world_id.dspy

11 lines
541 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.

# -*- coding: utf-8 -*-
# get_search_world_id.dspy —— 世界下拉([{value, text}]含全部同库dbname 已路由到 entity 库)
result = [{'value': '', 'text': '全部'}]
try:
async with get_sor_context(request._run_ns, 'entity') as sor:
recs = await sor.sqlExe('SELECT id AS value, world_name AS text FROM world ORDER BY world_name', {})
result = result + [dict(r) for r in (recs or [])]
except Exception as e:
debug(f'get_search_world_id error: {e}')
return json.dumps(result, ensure_ascii=False)