bugfix
This commit is contained in:
parent
5e7bdc5c2e
commit
835d206296
@ -1,17 +1,15 @@
|
|||||||
from sqlor.dbpools import DBPools
|
from sqlor.dbpools import DBPools
|
||||||
from ahserver.serverenv import get_serverenv
|
from ahserver.serverenv import ServerEnv
|
||||||
from appPublic.jsonConfig import getConfig
|
from appPublic.jsonConfig import getConfig
|
||||||
from appPublic.timeUtils import strdate_add
|
from appPublic.timeUtils import strdate_add
|
||||||
|
|
||||||
def get_dbname():
|
def get_dbname():
|
||||||
f = get_serverenv('get_module_dbname')
|
env = ServerEnv()
|
||||||
|
f = env.get_module_dbname
|
||||||
if f is None:
|
if f is None:
|
||||||
raise Exception('get_module_dbname not found')
|
raise Exception('get_module_dbname not found')
|
||||||
return f('appbase')
|
return f('appbase')
|
||||||
|
|
||||||
def _get_db():
|
|
||||||
return DBPools(getConfig().databases)
|
|
||||||
|
|
||||||
async def get_business_date(sor=None):
|
async def get_business_date(sor=None):
|
||||||
async def _f(sor):
|
async def _f(sor):
|
||||||
sql = "select * from params where params_name = 'business_date'"
|
sql = "select * from params where params_name = 'business_date'"
|
||||||
@ -23,7 +21,8 @@ async def get_business_date(sor=None):
|
|||||||
if sor:
|
if sor:
|
||||||
return await _f(sor)
|
return await _f(sor)
|
||||||
dbname = get_dbname()
|
dbname = get_dbname()
|
||||||
async with _get_db().sqlorContext(dbname) as sor:
|
db = DBPools()
|
||||||
|
async with db.sqlorContext(dbname) as sor:
|
||||||
return await _f(sor)
|
return await _f(sor)
|
||||||
|
|
||||||
async def new_business_date(sor=None):
|
async def new_business_date(sor=None):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user