sage/wwwroot/tenant_brand_data.dspy

12 lines
589 B
Plaintext

# 返回租户品牌数据(系统名+图标)
userorgid = await get_userorgid()
env = request._run_ns
async with get_sor_context(env, 'sage') as sor:
orgs = await sor.sqlExe('SELECT orgname, iconid, brand_name FROM organization WHERE id = ${orgid}$', {'orgid': userorgid})
org = orgs[0] if orgs else None
display_name = org.brand_name if org and org.brand_name else (org.orgname if org and org.orgname else 'OpenComputing')
iconid = org.iconid if org and org.iconid else ''
result = json.dumps({"orgname": display_name, "iconid": iconid}, ensure_ascii=False)
return result