Files
one-pipe-system/openspec/changes/add-historical-approval-resend/specs/agent-recharge/spec.md
luo d9d07422a9
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 5m44s
fix: update some files
2026-08-18 17:36:41 +08:00

57 lines
2.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## ADDED Requirements
### Requirement: Agent Recharge Historical Approval Resend API
The agent recharge service SHALL expose a historical approval resend operation through `POST /api/admin/agent-recharges/{id}/trigger-approval`.
#### Scenario: Resend approval for a historical offline recharge
- **GIVEN** 一个需要补发审批的历史线下代理充值记录 `id`
- **WHEN** 前端调用 `POST /api/admin/agent-recharges/{id}/trigger-approval`
- **THEN** 请求 MUST 在路径参数中携带该充值记录 `id`
- **AND** 成功响应 MUST 被解析为完整的 `AgentRecharge` 记录,并保留 `approval_provider``approval_instance_id``approval_status``approval_status_name` 字段
### Requirement: Agent Recharge Historical Approval Resend Entry
The agent recharge list page SHALL provide a `补发审批` action only for recharge records whose `approval_status` is empty and whose business `status` is not completed, rejected, or closed, and SHALL gate it by permission.
#### Scenario: Show resend action for an eligible recharge
- **GIVEN** 平台账号拥有 `agent_recharge:trigger_approval` 权限
- **AND** 充值记录的 `approval_status` 为空(`null``undefined`
- **AND** 充值记录的 `status` 不属于已完成3、已驳回6、已关闭4
- **WHEN** 页面渲染代理充值列表
- **THEN** 页面 MUST 为该记录显示“补发审批”操作
#### Scenario: Hide resend action when approval status is present
- **GIVEN** 充值记录的 `approval_status` 不为空
- **WHEN** 页面渲染该记录
- **THEN** 页面 MUST NOT 显示“补发审批”操作
#### Scenario: Hide resend action for terminal recharge statuses
- **GIVEN** 充值记录的 `status` 为已完成3、已驳回6或已关闭4
- **WHEN** 页面渲染该记录
- **THEN** 页面 MUST NOT 显示“补发审批”操作
#### Scenario: Hide resend action without permission
- **GIVEN** 当前账号不拥有 `agent_recharge:trigger_approval` 权限
- **WHEN** 页面渲染代理充值记录
- **THEN** 页面 MUST NOT 显示“补发审批”操作
#### Scenario: Resend approval succeeds
- **GIVEN** 用户对符合条件的充值记录点击“补发审批”
- **WHEN** 接口返回 `code=0`
- **THEN** 页面 MUST 显示成功提示并刷新列表
- **AND** 刷新后的记录 MUST 展示接口返回的最新审批状态
#### Scenario: Resend approval fails
- **GIVEN** 接口返回非零 `code` 或请求失败
- **WHEN** 用户触发“补发审批”
- **THEN** 页面 MUST 展示后端返回的错误信息
- **AND** 页面 MUST NOT 将记录标记为已补发审批