feat: 接入新参数:套餐分配生效条件选择,资产详情前代后代换货标识
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 7m0s
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 7m0s
This commit is contained in:
@@ -6,9 +6,10 @@
|
||||
|
||||
## What Changes
|
||||
|
||||
- 在套餐授权/分配和已分配套餐编辑入口增加“生效条件”单选:跟随套餐默认、购买即生效、实名即生效。
|
||||
- 在套餐授权/分配和已分配套餐编辑入口增加“生效条件”单选:跟随套餐默认、购买即生效、实名激活时生效。
|
||||
- 新建分配时调用 `POST /api/admin/shop-package-allocations`,明确传递 `expiry_base_override`;选择“跟随套餐默认”时 MUST 显式传递 `null`,不得省略字段。
|
||||
- 已分配套餐修改生效条件时调用 `PATCH /api/admin/shop-package-allocations/{id}/expiry-base`,请求体为 `expiry_base_override:null|from_purchase|from_realname`。
|
||||
- 系列授权创建、系列授权新增套餐和批量套餐分配时,均 MUST 显式传递 `expiry_base_override`;该配置只作用于本次新建分配。
|
||||
- 已分配套餐修改生效条件时调用 `PATCH /api/admin/shop-package-allocations/{id}/expiry-base`,请求体为 `expiry_base_override:null|from_purchase|from_activation`。
|
||||
- 在分配详情、编辑弹框和代理系列授权套餐列表展示后端返回的默认生效条件、覆盖生效条件和最终生效条件的中文名称。
|
||||
- 修改弹框提示“仅影响后续新订单,不影响已购买套餐”。
|
||||
- 前端不根据默认值和覆盖值自行计算最终生效条件,直接使用后端返回的 `effective_expiry_base` 及其名称字段。
|
||||
@@ -27,6 +28,9 @@
|
||||
- API contracts:
|
||||
- `POST /api/admin/shop-package-allocations`
|
||||
- `PATCH /api/admin/shop-package-allocations/{id}/expiry-base`
|
||||
- `POST /api/admin/shop-series-grants`
|
||||
- `PUT /api/admin/shop-series-grants/{id}/packages`
|
||||
- `POST /api/admin/shop-package-batch-allocations`
|
||||
- Out of scope:
|
||||
- 已购买套餐或历史订单的生效条件迁移
|
||||
- 前端根据分配字段推导或覆盖实际生效条件
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
### Requirement: Package Allocation Expiry Base Override Contract
|
||||
|
||||
The shop package allocation contract SHALL support an explicit `expiry_base_override` when creating or updating an allocation. The allowed request values MUST be `null`, `from_purchase`, and `from_realname`.
|
||||
The shop package allocation contract SHALL support an explicit `expiry_base_override` when creating or updating an allocation. The allowed request values MUST be `null`, `from_purchase`, and `from_activation`. The frontend MUST NOT send `from_realname`.
|
||||
|
||||
#### Scenario: Create allocation following the package default
|
||||
|
||||
@@ -18,11 +18,11 @@ The shop package allocation contract SHALL support an explicit `expiry_base_over
|
||||
- **WHEN** 用户创建店铺套餐分配
|
||||
- **THEN** 请求 MUST contain `expiry_base_override: "from_purchase"`
|
||||
|
||||
#### Scenario: Create allocation with realname activation override
|
||||
#### Scenario: Create allocation with activation override
|
||||
|
||||
- **GIVEN** 用户在套餐授权/分配弹框选择“实名即生效”
|
||||
- **GIVEN** 用户在套餐授权/分配弹框选择“实名激活时生效”
|
||||
- **WHEN** 用户创建店铺套餐分配
|
||||
- **THEN** 请求 MUST contain `expiry_base_override: "from_realname"`
|
||||
- **THEN** 请求 MUST contain `expiry_base_override: "from_activation"`
|
||||
|
||||
### Requirement: Package Allocation Expiry Base Update
|
||||
|
||||
@@ -31,7 +31,7 @@ The system SHALL update an existing package allocation's expiry-base override th
|
||||
#### Scenario: Update allocation expiry base override
|
||||
|
||||
- **GIVEN** 用户正在编辑已分配套餐的生效条件
|
||||
- **WHEN** 用户选择“购买即生效”或“实名即生效”并保存
|
||||
- **WHEN** 用户选择“购买即生效”或“实名激活时生效”并保存
|
||||
- **THEN** 系统 MUST call `PATCH /api/admin/shop-package-allocations/{id}/expiry-base`
|
||||
- **AND** 请求体 MUST contain the selected `expiry_base_override`
|
||||
|
||||
@@ -41,6 +41,13 @@ The system SHALL update an existing package allocation's expiry-base override th
|
||||
- **WHEN** 用户选择“跟随套餐默认”并保存
|
||||
- **THEN** 请求体 MUST explicitly contain `expiry_base_override: null`
|
||||
|
||||
#### Scenario: Use activation override enum
|
||||
|
||||
- **GIVEN** 用户在已分配套餐编辑弹框选择“实名激活时生效”
|
||||
- **WHEN** 用户保存生效条件
|
||||
- **THEN** 请求体 MUST contain `expiry_base_override: "from_activation"`
|
||||
- **AND** 请求体 MUST NOT contain `expiry_base_override: "from_realname"`
|
||||
|
||||
### Requirement: Package Allocation Expiry Base Resolution Response
|
||||
|
||||
The package allocation response SHALL provide `default_expiry_base`, `expiry_base_override`, and `effective_expiry_base`, together with their corresponding Chinese name fields. The frontend MUST render the returned effective value and name without calculating it from other fields.
|
||||
@@ -59,6 +66,13 @@ The package allocation response SHALL provide `default_expiry_base`, `expiry_bas
|
||||
- **THEN** 页面 MUST display the backend returned `effective_expiry_base_name`
|
||||
- **AND** 前端 MUST NOT calculate or replace the effective value from the default value and override value
|
||||
|
||||
#### Scenario: Display null override as following package default
|
||||
|
||||
- **GIVEN** 分配响应的 `expiry_base_override` 为 `null`
|
||||
- **WHEN** 页面展示覆盖生效条件
|
||||
- **THEN** 页面 MUST use `expiry_base_override_name` when it is returned
|
||||
- **AND** 页面 MUST display “跟随套餐默认” when the returned override name is empty or null
|
||||
|
||||
### Requirement: Package Allocation Expiry Base Applies Prospectively
|
||||
|
||||
The package allocation expiry-base override SHALL apply only to future new orders. The allocation creation and editing UI MUST inform the user that purchased packages are unaffected.
|
||||
@@ -72,3 +86,19 @@ The package allocation expiry-base override SHALL apply only to future new order
|
||||
|
||||
- **WHEN** 用户创建、更新或恢复套餐分配的生效条件
|
||||
- **THEN** 前端 MUST NOT attempt to update existing purchased packages or historical orders
|
||||
|
||||
### Requirement: Package Allocation Response Field Contract
|
||||
|
||||
All package allocation and package response objects involved in allocation management SHALL preserve the six expiry-base fields returned by the backend: `default_expiry_base`, `default_expiry_base_name`, `expiry_base_override`, `expiry_base_override_name`, `effective_expiry_base`, and `effective_expiry_base_name`.
|
||||
|
||||
#### Scenario: Preserve six expiry-base fields in allocation responses
|
||||
|
||||
- **WHEN** 前端接收套餐分配创建、更新、详情或列表响应
|
||||
- **THEN** 前端类型 MUST support all six expiry-base fields
|
||||
- **AND** 页面 MUST use backend-provided `*_name` fields for display
|
||||
|
||||
#### Scenario: Preserve six expiry-base fields in package responses
|
||||
|
||||
- **WHEN** 前端接收套餐列表、套餐详情、套餐创建或套餐更新响应
|
||||
- **THEN** 前端类型 MUST support all six expiry-base fields when returned by the API
|
||||
- **AND** 前端 MUST NOT infer allocation effective expiry behavior from package default fields
|
||||
|
||||
@@ -19,7 +19,7 @@ The series grant package list and package edit context SHALL display the package
|
||||
|
||||
### Requirement: Series Grant Package Expiry Base Editing
|
||||
|
||||
The series grant package edit context SHALL provide `跟随套餐默认`, `购买即生效`, and `实名即生效` options, then update the corresponding package allocation record through the package allocation expiry-base API.
|
||||
The series grant package edit context SHALL provide `跟随套餐默认`, `购买即生效`, and `实名激活时生效` options, then update the corresponding package allocation record through the package allocation expiry-base API.
|
||||
|
||||
#### Scenario: Edit override from series grant package list
|
||||
|
||||
@@ -28,6 +28,44 @@ The series grant package edit context SHALL provide `跟随套餐默认`, `购
|
||||
- **THEN** 系统 MUST use the corresponding package allocation record ID to call `PATCH /api/admin/shop-package-allocations/{id}/expiry-base`
|
||||
- **AND** 选择“跟随套餐默认”时请求 MUST explicitly contain `expiry_base_override: null`
|
||||
|
||||
### Requirement: Series Grant Creation Expiry Base Contract
|
||||
|
||||
The series grant creation and package addition flows SHALL explicitly send one shared `expiry_base_override` for all newly created package allocations. The allowed values MUST be `null`, `from_purchase`, and `from_activation`.
|
||||
|
||||
#### Scenario: Create series grant with shared expiry base override
|
||||
|
||||
- **WHEN** 前端调用 `POST /api/admin/shop-series-grants`
|
||||
- **THEN** 请求 MUST explicitly contain `expiry_base_override`
|
||||
- **AND** the selected value MUST apply to all package allocations created by the initial authorization
|
||||
|
||||
#### Scenario: Add packages to existing series grant with shared expiry base override
|
||||
|
||||
- **WHEN** 前端调用 `PUT /api/admin/shop-series-grants/{id}/packages` to add packages
|
||||
- **THEN** 请求 MUST explicitly contain `expiry_base_override`
|
||||
- **AND** the selected value MUST apply only to the newly added package allocations
|
||||
- **AND** modifying or deleting existing packages MUST NOT change their historical override values
|
||||
|
||||
#### Scenario: Restore default during series grant creation or package addition
|
||||
|
||||
- **WHEN** 用户选择“跟随套餐默认”
|
||||
- **THEN** 请求 MUST explicitly contain `expiry_base_override: null`
|
||||
- **AND** 请求 MUST NOT omit the field to represent the default
|
||||
|
||||
### Requirement: Batch Package Allocation Expiry Base Contract
|
||||
|
||||
The batch package allocation flow SHALL apply one explicitly selected `expiry_base_override` to all allocations created by the batch request.
|
||||
|
||||
#### Scenario: Create batch allocations with shared expiry base
|
||||
|
||||
- **WHEN** 前端调用 `POST /api/admin/shop-package-batch-allocations`
|
||||
- **THEN** 请求 MUST explicitly contain `expiry_base_override`
|
||||
- **AND** all returned `data.allocations[]` items MUST preserve the allocation ID and six expiry-base fields
|
||||
|
||||
#### Scenario: Batch allocation follows package default
|
||||
|
||||
- **WHEN** 用户在批量分配中选择“跟随套餐默认”
|
||||
- **THEN** 请求 MUST explicitly contain `expiry_base_override: null`
|
||||
|
||||
#### Scenario: Refresh effective value after editing
|
||||
|
||||
- **WHEN** 代理系列授权套餐的生效条件更新成功
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
## 2. Allocation Expiry Condition UI
|
||||
|
||||
- [x] 2.1 在套餐授权/分配弹框提供“跟随套餐默认”“购买即生效”“实名即生效”三选一。
|
||||
- [x] 2.1 在套餐授权/分配弹框提供“跟随套餐默认”“购买即生效”“实名激活时生效”三选一。
|
||||
- [x] 2.2 选择“跟随套餐默认”时显式提交 `expiry_base_override: null`。
|
||||
- [x] 2.3 在已分配套餐编辑弹框显示“仅影响后续新订单,不影响已购买套餐”提示。
|
||||
- [x] 2.4 在已分配套餐详情或编辑弹框显示默认值、覆盖值和最终值的后端中文名称。
|
||||
@@ -20,7 +20,7 @@
|
||||
## 4. Policy Integrity and Verification
|
||||
|
||||
- [x] 4.1 前端不从默认值和覆盖值计算或修改 `effective_expiry_base`。
|
||||
- [x] 4.2 验证新建分配时三种选项分别提交 `null`、`from_purchase`、`from_realname`。
|
||||
- [x] 4.2 验证新建分配时三种选项分别提交 `null`、`from_purchase`、`from_activation`,且不提交 `from_realname`。
|
||||
- [x] 4.3 验证编辑覆盖值和恢复默认均只影响后续新订单,不影响已购买套餐。
|
||||
- [x] 4.4 验证页面可区分默认值、覆盖值和最终生效条件,并正确显示后端中文名称。
|
||||
- [x] 4.5 运行相关前端校验,并执行 `openspec validate update-package-allocation-expiry-base-override --strict`。
|
||||
|
||||
Reference in New Issue
Block a user