entity/wwwroot/api/get_search_scene_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_scene_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, scene_name AS text FROM scene ORDER BY scene_name', {})
result = result + [dict(r) for r in (recs or [])]
except Exception as e:
debug(f'get_search_scene_id error: {e}')
return json.dumps(result, ensure_ascii=False)