fix: use get_module_dbname for discount db in init_free_customers
This commit is contained in:
parent
e4b746be5c
commit
f6c29c8c38
@ -5,6 +5,7 @@ if not userorgid:
|
|||||||
return {'widgettype': 'Error', 'options': {'title': 'Error', 'message': '请先登录', 'timeout': 3}}
|
return {'widgettype': 'Error', 'options': {'title': 'Error', 'message': '请先登录', 'timeout': 3}}
|
||||||
|
|
||||||
count = 0
|
count = 0
|
||||||
|
disc_dbname = get_module_dbname('discount')
|
||||||
async with DBPools().sqlorContext('sage') as sor:
|
async with DBPools().sqlorContext('sage') as sor:
|
||||||
# Get all users (filtered by org if not owner)
|
# Get all users (filtered by org if not owner)
|
||||||
if userorgid == '0':
|
if userorgid == '0':
|
||||||
@ -17,7 +18,7 @@ async with DBPools().sqlorContext('sage') as sor:
|
|||||||
if not users:
|
if not users:
|
||||||
return {'widgettype': 'Message', 'options': {'title': '提示', 'message': '该机构下无用户', 'type': 'warning', 'timeout': 3}}
|
return {'widgettype': 'Message', 'options': {'title': '提示', 'message': '该机构下无用户', 'type': 'warning', 'timeout': 3}}
|
||||||
|
|
||||||
async with DBPools().sqlorContext('discount') as disc_sor:
|
async with DBPools().sqlorContext(disc_dbname) as disc_sor:
|
||||||
for u in users:
|
for u in users:
|
||||||
existing = await disc_sor.sqlExe(
|
existing = await disc_sor.sqlExe(
|
||||||
'SELECT id FROM discount_customer_bind WHERE customerid = ${cid}$',
|
'SELECT id FROM discount_customer_bind WHERE customerid = ${cid}$',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user