From 656205bac294db963d3b30a56a68b02132cadd33 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Tue, 14 Apr 2026 10:40:02 +0800 Subject: [PATCH] bugfix --- accounting/test_accounting.py | 2 +- wwwroot/get_user_balance.dspy | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 wwwroot/get_user_balance.dspy diff --git a/accounting/test_accounting.py b/accounting/test_accounting.py index f36b955..0d1c53a 100644 --- a/accounting/test_accounting.py +++ b/accounting/test_accounting.py @@ -22,7 +22,7 @@ async def get_orgid_by_username(sor, username): async def accounting(username): env = ServerEnv() customerid = None - for i in range(10): + for i in range(1000): resellerid = '0' async with get_sor_context(env, 'accounting') as sor: ais = [] diff --git a/wwwroot/get_user_balance.dspy b/wwwroot/get_user_balance.dspy new file mode 100644 index 0000000..2523d80 --- /dev/null +++ b/wwwroot/get_user_balance.dspy @@ -0,0 +1,26 @@ +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' + } +}