Files
luo 049f8257fb
All checks were successful
构建并部署前端到测试环境 / deploy (push) Successful in 56s
feat: 新增网关限流
2026-10-24 16:22:28 +08:00

6.1 KiB
Raw Blame History

ADDED Requirements

Requirement: 停复机记录查询

The frontend SHALL provide global stop/resume records and single-card history using the two documented admin APIs. Global queries MUST include RFC3339 start_time and end_time with an ordered range no greater than 31 days, all documented optional filters and pagination of at most 100 rows. Single-card history MUST use the card ID rather than ICCID or device ID.

Scenario: 查询全局记录

  • WHEN 用户进入页面或修改筛选、页码
  • THEN 前端 MUST 请求 /api/admin/card-stop-resume-records,展示记录字段及 items/page/size/total
  • AND 不合法或缺失的时间区间 MUST 阻止请求并显示明确提示。

Scenario: 查看单卡历史

  • WHEN 获授权用户从单卡或设备绑定卡打开历史
  • THEN 前端 MUST 请求 /api/admin/iot-cards/{id}/stop-resume-records
  • AND 无卡 ID 或无入口权限时 MUST 不请求接口,切换卡后不得残留另一张卡的结果。

Requirement: 上游错误分类规则

The frontend SHALL implement rule listing, creation, modification, status change, deletion and non-persistent testing according to the documented fields. Rule maintenance MUST be restricted to super administrators. Testing SHALL support the current rule set and an optional valid draft, and display matched/rule_id/category/category_name/keyword/maybe_accepted.

Scenario: 普通账号测试分类

  • WHEN 具有测试权限的用户提交操作与上游原始信息
  • THEN 前端 MUST 调用 /api/admin/gateway-error-classifications/test 并展示实际命中结果
  • AND 空信息或超过 1000 字符 MUST 不得提交,不通过增删改接口测试草稿。

Scenario: 超级管理员维护

  • WHEN 超级管理员提交合法规则或确认启停、删除
  • THEN 前端 MUST 使用对应 CRUD 或 status 接口,成功后刷新列表
  • AND 普通账号 MUST 不显示维护入口且无法从处理函数发起维护请求。

Requirement: 网关限流组

The frontend SHALL implement group listing, details, creation, modification, status change and deletion, including carrier/global and status filters. Maintenance MUST be restricted to super administrators. max_qps MUST be an integer in 1–10000, reserved_qps MUST be a nonnegative integer less than max_qps, operations MUST be nonempty, high-priority operations MUST be a subset and MUST be nonempty when reserved QPS is positive.

Scenario: 维护限流组

  • WHEN 超级管理员提交限流组
  • THEN 前端 MUST 校验文档的必填、长度、范围及操作关联约束后调用 POST 或 PUT
  • AND 全局组 MUST 使用空账户值,不得错误提交为具体账户。

Scenario: 查询限流组

  • WHEN 获授权用户查询列表或详情
  • THEN 前端 MUST 分别调用 /api/admin/polling-rate-limit-groups 或 /{id} 并展示真实字段
  • AND 普通账号 MUST 不能通过详情页进入维护操作。

Requirement: 动态枚举与统计

The frontend SHALL load all seven enum collections from /api/admin/polling-options, and SHALL implement carrier summary and trend requests with documented parameter bounds. Undefined inner fields in carriers and points MUST be presented transparently from actual response data without invented metrics, silently substituted zeros or assumed chart series.

Scenario: 加载枚举

  • WHEN 页面需要筛选、编辑或显示网关枚举
  • THEN 前端 MUST 使用接口的 label/value,失败时提供错误反馈及重试
  • AND 未知只读枚举值 MUST 保留原始值,不被显示为另一个已知状态。

Scenario: 查询汇总与趋势

  • WHEN 用户选择合法的统计区间、运营商和聚合粒度
  • THEN 前端 MUST 请求对应 /api/admin/polling-stats/carriers 或 /{carrier_id}/trend
  • AND 汇总 minutes 为 1–60,趋势 minutes 不超过 10080,粒度为有效正整数,账户 0 MUST 可用
  • AND 契约缺失的内部字段 MUST 以实际字段或原始数据展示并说明限制。

Requirement: 菜单权限与交付

The frontend SHALL register four pages under existing polling management and honor the existing static/superadmin and backend-menu routing modes. Normal actions MUST use explicit xxx:xxx permissions. The handoff SHALL list menu name, URL, parent menu and button permission codes only for non-superadmin-exclusive configuration.

Scenario: 普通账号访问

  • WHEN 普通账号获得相应菜单和按钮权限
  • THEN 对应页面和普通查询、测试操作 MUST 可用
  • AND 未授权按钮和请求 MUST 不可用,超级管理员专属维护能力 MUST 不被普通按钮权限开启。

Scenario: 交付配置清单

  • WHEN 实现和验证结束
  • THEN 交付 MUST 列出实际实现的普通菜单与按钮权限,不列出仅超级管理员专属配置
  • AND MUST 披露未进行真实后端联调或统计字段不完整等验证限制。

Requirement: 店铺页面一致性

The frontend SHALL reuse the shop list search, table header, column settings, fullscreen and pagination components, and the shop detail back button, title and responsive description layout. All displayed business timestamps MUST use the same formatDateTime formatter as the shop list. Search expansion MUST be enabled if and only if there are at least four search fields. Carrier selection MUST be a remote dropdown searched by carrier name using /api/admin/carriers?page=1&page_size=20&carrier_name=... while requests keep numeric IDs.

Scenario: 展开与时间显示

  • WHEN 页面有少于 4 个搜索条件
  • THEN show-expand MUST 为 false;4 个及以上 MUST 为 true
  • AND 已知列表、详情及统计数据中的业务时间 MUST 展示为店铺列表相同格式,不直接显示 RFC3339 字符串。

Scenario: 按名称搜索运营商

  • WHEN 用户在运营商账户下拉输入名称
  • THEN 前端 MUST 请求 carriers 列表并携带 page=1、page_size=20、carrier_name
  • AND 编辑回显 MUST 保留原账户名称,筛选/保存 MUST 提交所选 numeric carrier_id,趋势未解析账户 MUST 仍可选择值 0。