pipeline-sdlc/wwwroot/api/get_project_select_options.dspy

10 lines
461 B
Plaintext

import json
try:
async with get_sor_context(request._run_ns, 'pipeline') as sor:
rows = await sor.sqlExe("select id as value, name as text from sd_projects order by created_at desc", {})
r = [{'value': '', 'text': '请选择'}] + list(rows)
return json.dumps(r, ensure_ascii=False)
except Exception as e:
debug(f'get_project_select_options error: {e}')
return json.dumps([{'value': '', 'text': '请选择'}], ensure_ascii=False)