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