feat(register): 客户注册自动开账户
register_user 注册成功后旁路调 accounting.openCustomerAccounts('0', orgid),
模块未加载/开户失败只记日志不阻断注册。库名经 get_module_dbname 跨应用解析。
This commit is contained in:
parent
f5b9d697b3
commit
1b00876cc5
@ -144,6 +144,20 @@ async def register_user(sor, ns):
|
||||
}
|
||||
]
|
||||
await create_user(sor, ns, roles)
|
||||
# 自动开客户账户(accounting 模块)。旁路,不阻断注册主流程:
|
||||
# 模块未加载/开户失败都只记日志,注册本身成功。
|
||||
try:
|
||||
env = ServerEnv()
|
||||
open_fn = getattr(env, 'openCustomerAccounts', None)
|
||||
get_dbname_fn = get_serverenv('get_module_dbname')
|
||||
if open_fn is not None and get_dbname_fn is not None:
|
||||
acc_dbname = get_dbname_fn('accounting')
|
||||
async with DBPools().sqlorContext(acc_dbname) as acc_sor:
|
||||
await open_fn(acc_sor, '0', ns.orgid)
|
||||
await acc_sor.sqlExe("COMMIT", {})
|
||||
debug(f'register_user: customer accounts opened for org({ns.orgid})')
|
||||
except Exception as e:
|
||||
debug(f'register_user: auto open customer accounts skipped: {e}')
|
||||
return {
|
||||
"status": "ok",
|
||||
"data": {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user