소스 검색

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