feat(shipping-notice): 增强订单抽取功能,添加进度事件和诊断运行管理,优化数据模型和访问控制

This commit is contained in:
hugo committed 2026-07-21 23:17:29 +08:00
1 parent ce26d6d0c4
commit c4095b08da
175 files changed
+13064 -1814

No files matched your search

@@ -20,6 +20,7 @@ from app import db
from app.core.config.env_persistence import persist_env_settings
from app.core.errors import AppError, ConflictError, NotFoundError, ValidationError
from app.models import Agent, LoginAudit, User, WecomNotifyAudit
from app.services.agent_user_access import load_grantable_agents
from app.services.auth import wecom_auth_service
from app.services.oa_wecom_sync import sync_wecom_userids_from_oa
@@ -313,10 +314,11 @@ def provision_user(data: dict[str, Any]) -> tuple[dict, int]:
except (TypeError, ValueError):
db.session.rollback()
raise ValidationError('agent_ids must be integer array')
agents = db.session.query(Agent).filter(Agent.id.in_(unique_ids)).all()
if len(agents) != len(unique_ids):
try:
agents = load_grantable_agents(unique_ids)
except ValidationError:
db.session.rollback()
raise ValidationError('Some agent_ids are invalid')
raise
user.agents = agents
else:
user.agents = []