From 1b00876cc5e52ba93065091cb92b5e9f020cc53b Mon Sep 17 00:00:00 2001 From: ymq Date: Wed, 26 Aug 2026 18:10:34 +0800 Subject: [PATCH] =?UTF-8?q?feat(register):=20=E5=AE=A2=E6=88=B7=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E8=87=AA=E5=8A=A8=E5=BC=80=E8=B4=A6=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit register_user 注册成功后旁路调 accounting.openCustomerAccounts('0', orgid), 模块未加载/开户失败只记日志不阻断注册。库名经 get_module_dbname 跨应用解析。 --- rbac/check_perm.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/rbac/check_perm.py b/rbac/check_perm.py index 33f0d34..ed0ae03 100644 --- a/rbac/check_perm.py +++ b/rbac/check_perm.py @@ -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": {