Files
junhong_cmp_fiber/openspec/specs/auto-resume-on-purchase/spec.md
huang ad095d73f3
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m8s
docs: 同步能力规范 — 新增购买/重置后复机 spec,更新停复机和排队激活规范
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-31 18:12:52 +08:00

37 lines
2.3 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: 购买套餐支付成功后自动复机
系统 SHALL 在支付回调成功激活套餐(`PackageUsage.status` 变为 1对因流量耗尽而停机的卡自动触发复机操作。
#### Scenario: C 端购买套餐支付成功后停机卡自动复机
- **GIVEN** 卡 C1 因流量耗尽停机(`network_status=0``stop_reason=traffic_exhausted`),已完成实名认证(`real_name_status=1`
- **WHEN** C 端用户为 C1 购买新套餐并完成微信/支付宝支付,`HandlePaymentCallback` 事务提交成功
- **THEN** 系统异步调用 `ResumeCardIfStopped(ctx, "iot_card", cardID)`
- **AND** 系统调用 `gateway.StartCard`,更新 `network_status=1`,清空 `stop_reason`
#### Scenario: 后台购买套餐(钱包支付)后停机卡自动复机
- **GIVEN** 卡 C2 因流量耗尽停机,已实名
- **WHEN** 后台管理员通过钱包支付为 C2 购买套餐,`HandlePaymentCallback` 事务提交成功,套餐状态为 `status=1`
- **THEN** 系统调用复机逻辑C2 自动复机
#### Scenario: 购买排队套餐(新套餐为 Pending 状态)时不触发复机
- **GIVEN** 卡 C3 已有生效中套餐,用户购买第二个套餐(新套餐创建为 `status=0` Pending
- **WHEN** 支付成功,`HandlePaymentCallback` 完成
- **THEN** 系统 SHALL NOT 触发复机调用(仅在套餐变为 `status=1` 时才复机)
#### Scenario: 未实名卡购买套餐不触发复机
- **GIVEN** 卡 C4 停机(`stop_reason=traffic_exhausted`),但 `real_name_status=0`(未实名)
- **WHEN** 为 C4 购买新套餐且套餐激活为 `status=1`
- **THEN** `ResumeCardIfStopped` 内部检测到未实名静默跳过C4 保持停机状态
#### Scenario: 停机原因非流量耗尽时不触发复机
- **GIVEN** 卡 C5 因手动停机(`stop_reason=manual`
- **WHEN** 为 C5 购买新套餐并激活
- **THEN** `ResumeCardIfStopped` 检测到 `stop_reason` 不为 `traffic_exhausted`,静默跳过
#### Scenario: 设备类型载体购买套餐后自动复机
- **GIVEN** 设备 D1 绑定了 3 张卡,其中 2 张已实名且因流量耗尽停机1 张未实名
- **WHEN** 为 D1 购买设备级套餐并激活
- **THEN** 已实名的 2 张卡自动复机,未实名的 1 张卡保持停机状态