accounting/wwwroot/get_user_balance.dspy
2026-04-14 10:40:02 +08:00

27 lines
470 B
Plaintext

username= params_kw.username
env = request._run_ns
async with get_sor_context(env, 'accounting') as sor:
sql = """select
d.username,
c.name,
a.balance
from account a, subject c, users d
where a.orgid = d.orgid
and a.subjectid = c.id
and d.username = ${username}$
"""
recs = swait or.sqlExe(sql, {
'username': username,
'sort': 'username'
})
return {
'status': 'ok',
'data': recs
}
return {
'status': 'error',
'data': {
'message': 'system error'
}
}