Repository navigation
feat(accounts): 支持调度定时打开与关闭 - #516
Merged
Merged
Conversation
ranxi2001
marked this pull request as ready for review
October 21, 2026 18:14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat(accounts): 支持允许调度的一次性定时打开与关闭
解决的问题与行为变化
账号管理原来只能立即切换允许调度。现在在原开关上方增加「定时打开」「定时关闭」:支持服务端接受保存后 8h/自填小时分钟,或指定 IANA 时区的日期与 HH:mm。日期留空会先展示下一次具体日期、时间与 UTC 偏移,确认后保存为一次性计划,DST 不存在/重复时刻拒绝。桌面与移动端共享入口、待执行日期/时区/倒计时、编辑取消、结果及中英文案。
每账号各保留一个打开和关闭计划,同动作版本替换,相反动作不能同瞬间。管理员立即切换前明确警告,并在后端同事务取消所有 pending;自动质量/cooldown 不冒充管理员意图。任务持久化 UTC + 原始时区,复用账号到期后台生命周期、账号快照及 scheduler outbox。
30 秒轮询而非秒级保证;关闭允许恢复后补执行,打开超过 15 分钟跳过。执行仅更新 schedulable,保留 disabled/到期/配额/限流/质量/IP ACL 等硬门槛,不动余额/账本/结算/支付。账号锁 + SKIP LOCKED + 版本复核 + 同账号时间顺序将计划取消/编辑/手动切换与执行串行化;状态、审计、outbox 同事务,数据库可写时最多三次执行尝试。
关联记录与来源
8f698507dabfce8d83c7c76cbd0d528a4417a8ae,本地 head2174667d9fdc84a3a03506808d44e265f19f857c。复现与验收
实际验证
详细命令和日志在本地
/data/development/artifacts/sub2api-account-schedulable-timer-verification.md;截图为 artifacts 下sub2api-account-timer-{desktop,mobile}-{before,after}.png,正式 PR 应由维护者上传附件,本正文不将本地路径冒充可公开链接。兼容性与运行影响
295_account_schedulable_timers.sql,只增加表/部分索引,不改 accounts schema、Ent 或 Wire。默认最长 366 天;所有实例可统一配置ACCOUNT_SCHEDULABLE_TIMER_MAX_DAYS=1..3660。文档与用户可见变化
新增
docs/account-schedulable-timers.md:时间语义、执行恢复、事务/多实例、API、配置、审计和回退限制。页面保留原立即开关;中英新增时间计划与警告文案。Agent 使用声明