5.5 KiB
ADDED Requirements
Requirement: 当前及未保存配置匹配预览
The frontend SHALL implement GET and POST /api/admin/polling-configs/match-preview. ICCID MUST be nonempty and at most 30 characters. POST MUST send the identical ICCID in query and JSON body, with optional overrides. Results MUST show the card, all matched configurations and final task intervals, preserving interval/disabled/unmatched modes, inherited and draft indicators. Preview MUST NOT call create/update/delete/status APIs.
Scenario: 当前配置预览
- WHEN 获匹配预览权限的用户输入 ICCID 查询当前配置
- THEN 前端 MUST 发起 GET 查询并展示 card、matched、intervals,不擅自推导匹配顺序或最终间隔。
Scenario: 草稿覆盖预览
- WHEN 用户添加 id=0 的新草稿或覆盖已有配置并提交
- THEN 前端 MUST 发起 POST,Query 与 Body 的 iccid 一致,overrides 保留原有顺序、id 和 disabled
- AND 编辑未保存字段 MUST 不触发真实写接口,旧预览结果 MUST 不污染新的卡或草稿。
Requirement: 草稿字段与检查语义
The draft form SHALL support every documented override field. The four ordinary task intervals MUST distinguish null/omitted inheritance, zero disable-without-inheritance and positive intervals subject to documented minima. Protect interval null MUST mean no check and non-null values MUST be integers of at least 30. Pre-reset window fields MUST use documented minima and clearly explain that both are required for effect. New preview-only fields MUST NOT be silently added to undocumented persisted CRUD bodies.
Scenario: 禁用与继承不同
- WHEN 用户将实名、流量、套餐或卡状态检查设为禁用
- THEN 对应值 MUST 为 0,不得变成 null 或被过滤掉
- AND 继承模式 MUST 使用 null/省略值,正数模式 MUST 校验对应 30 或 60 秒下限。
Scenario: 新字段隔离
- WHEN 草稿设置资产状态、套餐状态或重置日前窗口
- THEN 字段 MUST 仅进入已定义的 overrides 契约,不得因预览自动保存配置。
Requirement: 优先级调整与异步重算
The frontend SHALL implement PUT /api/admin/polling-configs/priorities and POST /api/admin/polling-configs/recalculate-due with superadmin-only UI and event guards, explicit confirmation and duplicate-submit prevention. Ordered IDs MUST be nonempty, unique and valid; no undefined success DTO SHALL be assumed. Recalculation MUST be described as advance-only asynchronous work, not immediate completion of all card actions.
Scenario: 保存优先级顺序
- WHEN 超级管理员确认有效顺序
- THEN 前端 MUST 提交 ordered_ids 并在成功后重新获取列表
- AND 普通账号 MUST 无法通过 UI 或处理函数发起调序或重算启动。
Scenario: 启动重算
- WHEN 超级管理员选择运营商账户或全部并确认
- THEN 前端 MUST 提交 number/null carrier_id、保留 task_id 并展示真实任务状态,不在 POST 返回时直接宣称重算完成。
Requirement: 任务进度查询
The frontend SHALL expose GET /api/admin/polling-configs/recalculate-due/{task_id} under a normal-user progress permission. It MUST show task ID, status, total/processed/advanced, response string carrier ID, errors and formatted timestamps. Automatic polling MUST cease on terminal status, closure, unmount or scope change, and late responses MUST be discarded.
Scenario: 查询已知任务
- WHEN 获进度权限的用户输入非空 task_id
- THEN 前端 MUST 对路径参数编码后查询并展示实际数据
- AND 查询权限 MUST 不授予创建重算任务的能力。
Scenario: 终态及关闭
- WHEN 任务 completed/failed 或对话框关闭、组件卸载
- THEN 自动查询 MUST 停止,不得后台无限轮询或由旧结果覆盖新任务。
Requirement: 轮询配置统计
The frontend SHALL provide a new config statistics page under polling management for GET /api/admin/polling-stats/pre-reset and GET /api/admin/polling-stats/tiers, gated by page and separate ordinary view permissions. It MUST preserve null versus zero, label approximate counts, highlight unmatched-card warnings and indicate the five-minute tiers cache without promising forced cache invalidation.
Scenario: 重置日前统计
- WHEN 用户查看有数据或 null 的 previous/upcoming 周期
- THEN 前端 MUST 展示运营商、重置时间、套餐卡数、窗口检查/未检查及接口给定的分钟桶
- AND null MUST 显示无周期数据,真实 0 MUST 保留,不将桶擅自转换成未定义的差分或精确比例。
Scenario: 分层统计
- WHEN 用户打开分层统计
- THEN 前端 MUST 展示 by_config、by_package_state、computed_at、total_cards 和两个未匹配告警计数
- AND config_id=0 MUST 显示未匹配,不假定该配置存在。
Requirement: 界面一致性与配置交付
The frontend SHALL reuse shop-list/detail conventions, formatDateTime, carrier-name remote search and search expansion only for at least four fields. Handoff MUST list the actual new menu name, URL, parent, page codes and ordinary action codes, excluding superadmin-exclusive configuration and distinguishing local mock verification from live integration.
Scenario: 菜单权限配置
- WHEN 本次实现交付
- THEN MUST 提供轮询管理下统计页及现有配置页新增按钮的准确配置
- AND 既有 CRUD 权限 MUST 不因未声明迁移被移除,不创建新的一级菜单。