feat: 添加飞书用户模块和订阅功能支持

- 新增feishu_users模块用于处理飞书用户身份验证和权限管理
- 新增subscriptions模块用于处理订阅相关功能
- 新增personalization模块用于个性化服务
- 在alembic迁移配置中注册新的模型模块
- 在API路由器中添加feishu_users和subscriptions路由
- 实现事件调度服务的改进,包括错误处理和状态更新优化
- 添加飞书命令处理的权限检查机制
- 实现飞书应用票据事件处理
- 改进审计日志记录功能
```
This commit is contained in:
2026-07-27 08:02:17 +08:00
parent db751f03b4
commit d7db84571d
148 changed files with 17110 additions and 765 deletions

View File

@@ -12,6 +12,7 @@ from app.tasks.constants import (
from app.core.constants import ActorValue
from app.core.database import SessionLocal
from app.modules.feishu.constants import FeishuReceiveIdType
from app.modules.reports.constants import ReportPushStatus
from app.tasks.app import celery_app
ReportBuilder = Callable[[Any, str], dict[str, Any]]
@@ -96,6 +97,10 @@ def _push_report(
db = SessionLocal()
try:
service = ReportService(db)
if push_run_code:
push_run = service._get_push_run(push_run_code)
if push_run.status == ReportPushStatus.SUCCESS:
return dict(push_run.provider_response or {})
report = build_report(service, actor)
return ReportDeliveryService(db).push_report(
report,
@@ -104,6 +109,18 @@ def _push_report(
actor,
push_run_code=push_run_code,
)
except Exception as exc:
if push_run_code:
db.rollback()
try:
ReportService(db).update_push_run(
push_run_code,
ReportPushStatus.FAILED,
error_message=str(exc),
)
except Exception:
db.rollback()
raise
finally:
db.close()