diff --git a/accounting/getdbname.py b/accounting/getdbname.py new file mode 100644 index 0000000..5d2fcf5 --- /dev/null +++ b/accounting/getdbname.py @@ -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') diff --git a/accounting/recharge.py b/accounting/recharge.py index d93306e..b416510 100644 --- a/accounting/recharge.py +++ b/accounting/recharge.py @@ -4,6 +4,7 @@ from appPublic.uniqueID import getID from sqlor.dbpools import DBPools from appPublic.timeUtils import curDateString from appPublic.argsConvert import ArgsConvert +from getdbname import get_dbname from .accounting_config import get_accounting_config, Accounting from .const import * from .excep import * @@ -79,7 +80,7 @@ async def recharge_accounting(sor, customerid, action, orderid, transdate, recha return True db = DBPools() - dbname = await rfrun('get_module_dbname', 'accounting') + dbname = get_dbname() async with db.sqlorContext(dbname) as sor: r = await ra.accounting(sor) return True