feat(fulfillment): 支持共享账号操作并完善时间线

This commit is contained in:
yml
2026-11-18 22:32:45 +08:00
parent 86b586b96d
commit ddead2284d
23 changed files with 538 additions and 15 deletions
+28 -2
View File
@@ -19,7 +19,7 @@ from ..models import (
LoginTask,
User,
)
from ..permissions import user_has_permission
from ..permissions import ROLE_LABELS, user_has_permission
from ..schemas import (
AccountAssign,
AccountAutomationUpdate,
@@ -1856,8 +1856,34 @@ def account_events(
.all()
)
items = [dict(row) for row in rows]
actor_ids = {
int(item["actor_id"])
for item in items
if item.get("actor_type") == "user"
and item.get("actor_id") is not None
}
actors = {
int(user.id): user
for user in db.query(User).filter(User.id.in_(actor_ids)).all()
} if actor_ids else {}
for item in items:
actor = (
actors.get(int(item["actor_id"]))
if item.get("actor_type") == "user"
and item.get("actor_id") is not None
else None
)
item["actor_name"] = (
actor.deleted_username or actor.username
) if actor is not None else ""
item["actor_role"] = actor.role if actor is not None else ""
item["actor_role_label"] = (
ROLE_LABELS.get(actor.role, actor.role) if actor is not None else ""
)
return {
"items": [dict(row) for row in rows],
"items": items,
"total": int(total),
"page": page,
"page_size": page_size,