瀏覽代碼

chore: 加 log 排查 enterprise_id 推导

alphah 2 周之前
父節點
當前提交
3e485dd899
共有 1 個文件被更改,包括 2 次插入0 次删除
  1. 2 0
      backend/app/plugin/module_payment/expense/institution/controller.py

+ 2 - 0
backend/app/plugin/module_payment/expense/institution/controller.py

@@ -54,9 +54,11 @@ async def create_institution_controller(
         from app.plugin.module_payment.enterprise.model import EnterpriseModel
         from sqlalchemy import select
         tenant_id = auth.user.tenant_id if auth.user and auth.user.tenant_id else auth.tenant_id
+        log.info(f"推导 enterprise_id: tenant_id={tenant_id}, user_tenant_id={getattr(auth.user, 'tenant_id', None)}")
         stmt = select(EnterpriseModel).where(EnterpriseModel.tenant_id == tenant_id).limit(1)
         result = await auth.db.execute(stmt)
         enterprise = result.scalar_one_or_none()
+        log.info(f"查询 enterprise 结果: {enterprise.enterprise_id if enterprise else 'None'}")
         enterprise_id = enterprise.enterprise_id if enterprise else ""
         if enterprise_id:
             data["enterprise_id"] = enterprise_id