feat(accounts): 统一可换绑时间并加本地 7 天锁

- 新增官方时间、本地 bind_ok、7 天锁到期、检查时间和来源字段
- role_change_available_at 改为官方时间与本地锁取较晚者
- 绑定成功和官方探测统一写有效时间
- 分配过滤增加最近 elite bind_ok 的数据库兜底
- 迁移 0129 从 account_events 回填历史账号
- 补充字段/回填过滤测试和生命周期文档
This commit is contained in:
yml
2026-11-24 17:37:15 +08:00
parent a1530b7e74
commit 2e6303361c
11 changed files with 415 additions and 9 deletions
+9 -1
View File
@@ -22,6 +22,7 @@ from .account_binding import (
binding_pending_decision,
binding_snapshot,
classify_bind_cooldown,
effective_role_change_available_at,
is_bound_act,
is_pending_binding_role,
is_role_change_cooling,
@@ -408,7 +409,14 @@ class BindMixin:
snapshot["game_channel"].replace(" / ", " · ") or account.game_channel
)
account.change_role_wait_time = snapshot["change_role_wait_time"]
account.role_change_available_at = role_change_available_at(bind_info)
official_at = role_change_available_at(bind_info)
account.role_change_official_at = official_at
account.role_change_checked_at = datetime.now(UTC)
account.role_change_available_at = effective_role_change_available_at(
official_at=official_at,
last_bind_ok_at=account.last_bind_ok_at,
)
account.role_change_source = "official"
if state is not None:
set_bind_status(account, SCOPE_ELITE, state)
account.updated_at = datetime.now(UTC)