feat(accounts): 统一可换绑时间并加本地 7 天锁
- 新增官方时间、本地 bind_ok、7 天锁到期、检查时间和来源字段 - role_change_available_at 改为官方时间与本地锁取较晚者 - 绑定成功和官方探测统一写有效时间 - 分配过滤增加最近 elite bind_ok 的数据库兜底 - 迁移 0129 从 account_events 回填历史账号 - 补充字段/回填过滤测试和生命周期文档
This commit is contained in:
@@ -173,6 +173,25 @@ class Account(Base):
|
||||
role_change_available_at: Mapped[datetime | None] = mapped_column(
|
||||
UTCDateTime, nullable=True
|
||||
)
|
||||
# 官方接口给出的可换绑时刻(canChangeTime / now+wait_time)。与下面的本地
|
||||
# 7 天锁分开存:官方时间可能早于本地锁,不能直接用于分配。
|
||||
role_change_official_at: Mapped[datetime | None] = mapped_column(
|
||||
UTCDateTime, nullable=True
|
||||
)
|
||||
# 最近一次精英 bind_ok 的业务发生时间,以及本地“一个账号 7 天只能绑一个角色”
|
||||
# 的锁到期时间。分配只看 role_change_available_at(官方时间与本地锁取大)。
|
||||
last_bind_ok_at: Mapped[datetime | None] = mapped_column(
|
||||
UTCDateTime, nullable=True
|
||||
)
|
||||
role_bind_lock_until: Mapped[datetime | None] = mapped_column(
|
||||
UTCDateTime, nullable=True
|
||||
)
|
||||
role_change_checked_at: Mapped[datetime | None] = mapped_column(
|
||||
UTCDateTime, nullable=True
|
||||
)
|
||||
role_change_source: Mapped[str | None] = mapped_column(
|
||||
String(16), nullable=True
|
||||
)
|
||||
# 精英宝典当前有效开通状态(getUserInfo 的 manualType + expireTime)。
|
||||
# manualType 只表示开过;写入时还要按 expireTime 判断是否已过期。
|
||||
# 光看积分区分不了「开通后积分花完」和「从未开通」,必须单独落库。
|
||||
|
||||
Reference in New Issue
Block a user