This commit is contained in:
yumoqing 2025-04-12 19:42:33 +08:00
parent 7e45b4d0e2
commit fd960cffee
2 changed files with 9 additions and 1 deletions

7
accounting/getdbname.py Normal file
View File

@ -0,0 +1,7 @@
from ahserver.serverenv import get_serverenv
def get_dbname():
f = get_serverenv('get_module_dbname')
if f is None:
raise Exception('get_module_dbname() not found')
return f('accounting')

View File

@ -4,6 +4,7 @@ from appPublic.uniqueID import getID
from sqlor.dbpools import DBPools from sqlor.dbpools import DBPools
from appPublic.timeUtils import curDateString from appPublic.timeUtils import curDateString
from appPublic.argsConvert import ArgsConvert from appPublic.argsConvert import ArgsConvert
from getdbname import get_dbname
from .accounting_config import get_accounting_config, Accounting from .accounting_config import get_accounting_config, Accounting
from .const import * from .const import *
from .excep import * from .excep import *
@ -79,7 +80,7 @@ async def recharge_accounting(sor, customerid, action, orderid, transdate, recha
return True return True
db = DBPools() db = DBPools()
dbname = await rfrun('get_module_dbname', 'accounting') dbname = get_dbname()
async with db.sqlorContext(dbname) as sor: async with db.sqlorContext(dbname) as sor:
r = await ra.accounting(sor) r = await ra.accounting(sor)
return True return True