feat: 实现套餐管理模块,包含套餐系列、双状态管理、废弃模型清理
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 5m24s

- 新增套餐系列管理 (CRUD + 状态切换)
- 新增套餐管理 (CRUD + 启用/禁用 + 上架/下架双状态)
- 清理 8 个废弃分佣模型及对应数据库表
- Package 模型新增建议成本价、建议售价、上架状态字段
- 完整的 Store/Service/Handler 三层实现
- 包含单元测试和集成测试
- 归档 add-package-module change
- 新增多个 OpenSpec changes (订单支付、店铺套餐分配、一次性分佣、卡设备系列绑定)
This commit is contained in:
2026-01-27 19:55:47 +08:00
parent 30a0717316
commit 79c061b6fa
70 changed files with 7554 additions and 244 deletions

View File

@@ -821,6 +821,91 @@ components:
description: 提现单号
type: string
type: object
DtoCreatePackageRequest:
properties:
data_amount_mb:
description: 总流量额度(MB)
minimum: 0
nullable: true
type: integer
data_type:
description: 流量类型 (real:真流量, virtual:虚流量)
nullable: true
type: string
duration_months:
description: 套餐时长(月数)
maximum: 120
minimum: 1
type: integer
package_code:
description: 套餐编码
maxLength: 100
minLength: 1
type: string
package_name:
description: 套餐名称
maxLength: 255
minLength: 1
type: string
package_type:
description: 套餐类型 (formal:正式套餐, addon:附加套餐)
type: string
price:
description: 套餐价格(分)
minimum: 0
type: integer
real_data_mb:
description: 真流量额度(MB)
minimum: 0
nullable: true
type: integer
series_id:
description: 套餐系列ID
minimum: 0
nullable: true
type: integer
suggested_cost_price:
description: 建议成本价(分)
minimum: 0
nullable: true
type: integer
suggested_retail_price:
description: 建议售价(分)
minimum: 0
nullable: true
type: integer
virtual_data_mb:
description: 虚流量额度(MB)
minimum: 0
nullable: true
type: integer
required:
- package_code
- package_name
- package_type
- duration_months
- price
type: object
DtoCreatePackageSeriesRequest:
properties:
description:
description: 描述
maxLength: 500
type: string
series_code:
description: 系列编码
maxLength: 100
minLength: 1
type: string
series_name:
description: 系列名称
maxLength: 255
minLength: 1
type: string
required:
- series_code
- series_name
type: object
DtoCreatePermissionRequest:
properties:
parent_id:
@@ -1963,6 +2048,130 @@ components:
description: 已提现佣金(分)
type: integer
type: object
DtoPackagePageResult:
properties:
list:
description: 套餐列表
items:
$ref: '#/components/schemas/DtoPackageResponse'
nullable: true
type: array
page:
description: 当前页
type: integer
page_size:
description: 每页数量
type: integer
total:
description: 总数
type: integer
total_pages:
description: 总页数
type: integer
type: object
DtoPackageResponse:
properties:
created_at:
description: 创建时间
type: string
data_amount_mb:
description: 总流量额度(MB)
type: integer
data_type:
description: 流量类型 (real:真流量, virtual:虚流量)
type: string
duration_months:
description: 套餐时长(月数)
type: integer
id:
description: 套餐ID
minimum: 0
type: integer
package_code:
description: 套餐编码
type: string
package_name:
description: 套餐名称
type: string
package_type:
description: 套餐类型 (formal:正式套餐, addon:附加套餐)
type: string
price:
description: 套餐价格(分)
type: integer
real_data_mb:
description: 真流量额度(MB)
type: integer
series_id:
description: 套餐系列ID
minimum: 0
nullable: true
type: integer
shelf_status:
description: 上架状态 (1:上架, 2:下架)
type: integer
status:
description: 状态 (1:启用, 2:禁用)
type: integer
suggested_cost_price:
description: 建议成本价(分)
type: integer
suggested_retail_price:
description: 建议售价(分)
type: integer
updated_at:
description: 更新时间
type: string
virtual_data_mb:
description: 虚流量额度(MB)
type: integer
type: object
DtoPackageSeriesPageResult:
properties:
list:
description: 套餐系列列表
items:
$ref: '#/components/schemas/DtoPackageSeriesResponse'
nullable: true
type: array
page:
description: 当前页
type: integer
page_size:
description: 每页数量
type: integer
total:
description: 总数
type: integer
total_pages:
description: 总页数
type: integer
type: object
DtoPackageSeriesResponse:
properties:
created_at:
description: 创建时间
type: string
description:
description: 描述
type: string
id:
description: 系列ID
minimum: 0
type: integer
series_code:
description: 系列编码
type: string
series_name:
description: 系列名称
type: string
status:
description: 状态 (1:启用, 2:禁用)
type: integer
updated_at:
description: 更新时间
type: string
type: object
DtoPermissionPageResult:
properties:
items:
@@ -2873,6 +3082,102 @@ components:
required:
- status
type: object
DtoUpdatePackageParams:
properties:
data_amount_mb:
description: 总流量额度(MB)
minimum: 0
nullable: true
type: integer
data_type:
description: 流量类型 (real:真流量, virtual:虚流量)
nullable: true
type: string
duration_months:
description: 套餐时长(月数)
maximum: 120
minimum: 1
nullable: true
type: integer
package_name:
description: 套餐名称
maxLength: 255
minLength: 1
nullable: true
type: string
package_type:
description: 套餐类型 (formal:正式套餐, addon:附加套餐)
nullable: true
type: string
price:
description: 套餐价格(分)
minimum: 0
nullable: true
type: integer
real_data_mb:
description: 真流量额度(MB)
minimum: 0
nullable: true
type: integer
series_id:
description: 套餐系列ID
minimum: 0
nullable: true
type: integer
suggested_cost_price:
description: 建议成本价(分)
minimum: 0
nullable: true
type: integer
suggested_retail_price:
description: 建议售价(分)
minimum: 0
nullable: true
type: integer
virtual_data_mb:
description: 虚流量额度(MB)
minimum: 0
nullable: true
type: integer
type: object
DtoUpdatePackageSeriesParams:
properties:
description:
description: 描述
maxLength: 500
nullable: true
type: string
series_name:
description: 系列名称
maxLength: 255
minLength: 1
nullable: true
type: string
type: object
DtoUpdatePackageSeriesStatusParams:
properties:
status:
description: 状态 (1:启用, 2:禁用)
type: integer
required:
- status
type: object
DtoUpdatePackageShelfStatusParams:
properties:
shelf_status:
description: 上架状态 (1:上架, 2:下架)
type: integer
required:
- shelf_status
type: object
DtoUpdatePackageStatusParams:
properties:
status:
description: 状态 (1:启用, 2:禁用)
type: integer
required:
- status
type: object
DtoUpdatePasswordParams:
properties:
new_password:
@@ -7062,6 +7367,664 @@ paths:
summary: 发起提现申请
tags:
- 我的佣金
/api/admin/package-series:
get:
parameters:
- description: 页码
in: query
name: page
schema:
description: 页码
minimum: 1
type: integer
- description: 每页数量
in: query
name: page_size
schema:
description: 每页数量
maximum: 100
minimum: 1
type: integer
- description: 系列名称(模糊搜索)
in: query
name: series_name
schema:
description: 系列名称(模糊搜索)
maxLength: 255
nullable: true
type: string
- description: 状态 (1:启用, 2:禁用)
in: query
name: status
schema:
description: 状态 (1:启用, 2:禁用)
nullable: true
type: integer
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/DtoPackageSeriesPageResult'
description: OK
"400":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 请求参数错误
"401":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 未认证或认证已过期
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 无权访问
"500":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 服务器内部错误
security:
- BearerAuth: []
summary: 套餐系列列表
tags:
- 套餐系列管理
post:
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/DtoCreatePackageSeriesRequest'
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/DtoPackageSeriesResponse'
description: OK
"400":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 请求参数错误
"401":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 未认证或认证已过期
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 无权访问
"500":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 服务器内部错误
security:
- BearerAuth: []
summary: 创建套餐系列
tags:
- 套餐系列管理
/api/admin/package-series/{id}:
delete:
parameters:
- description: ID
in: path
name: id
required: true
schema:
description: ID
minimum: 0
type: integer
responses:
"400":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 请求参数错误
"401":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 未认证或认证已过期
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 无权访问
"500":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 服务器内部错误
security:
- BearerAuth: []
summary: 删除套餐系列
tags:
- 套餐系列管理
get:
parameters:
- description: ID
in: path
name: id
required: true
schema:
description: ID
minimum: 0
type: integer
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/DtoPackageSeriesResponse'
description: OK
"400":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 请求参数错误
"401":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 未认证或认证已过期
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 无权访问
"500":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 服务器内部错误
security:
- BearerAuth: []
summary: 获取套餐系列详情
tags:
- 套餐系列管理
put:
parameters:
- description: ID
in: path
name: id
required: true
schema:
description: ID
minimum: 0
type: integer
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/DtoUpdatePackageSeriesParams'
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/DtoPackageSeriesResponse'
description: OK
"400":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 请求参数错误
"401":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 未认证或认证已过期
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 无权访问
"500":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 服务器内部错误
security:
- BearerAuth: []
summary: 更新套餐系列
tags:
- 套餐系列管理
/api/admin/package-series/{id}/status:
patch:
parameters:
- description: ID
in: path
name: id
required: true
schema:
description: ID
minimum: 0
type: integer
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/DtoUpdatePackageSeriesStatusParams'
responses:
"400":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 请求参数错误
"401":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 未认证或认证已过期
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 无权访问
"500":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 服务器内部错误
security:
- BearerAuth: []
summary: 更新套餐系列状态
tags:
- 套餐系列管理
/api/admin/packages:
get:
parameters:
- description: 页码
in: query
name: page
schema:
description: 页码
minimum: 1
type: integer
- description: 每页数量
in: query
name: page_size
schema:
description: 每页数量
maximum: 100
minimum: 1
type: integer
- description: 套餐名称(模糊搜索)
in: query
name: package_name
schema:
description: 套餐名称(模糊搜索)
maxLength: 255
nullable: true
type: string
- description: 套餐系列ID
in: query
name: series_id
schema:
description: 套餐系列ID
minimum: 0
nullable: true
type: integer
- description: 状态 (1:启用, 2:禁用)
in: query
name: status
schema:
description: 状态 (1:启用, 2:禁用)
nullable: true
type: integer
- description: 上架状态 (1:上架, 2:下架)
in: query
name: shelf_status
schema:
description: 上架状态 (1:上架, 2:下架)
nullable: true
type: integer
- description: 套餐类型 (formal:正式套餐, addon:附加套餐)
in: query
name: package_type
schema:
description: 套餐类型 (formal:正式套餐, addon:附加套餐)
nullable: true
type: string
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/DtoPackagePageResult'
description: OK
"400":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 请求参数错误
"401":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 未认证或认证已过期
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 无权访问
"500":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 服务器内部错误
security:
- BearerAuth: []
summary: 套餐列表
tags:
- 套餐管理
post:
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/DtoCreatePackageRequest'
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/DtoPackageResponse'
description: OK
"400":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 请求参数错误
"401":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 未认证或认证已过期
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 无权访问
"500":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 服务器内部错误
security:
- BearerAuth: []
summary: 创建套餐
tags:
- 套餐管理
/api/admin/packages/{id}:
delete:
parameters:
- description: ID
in: path
name: id
required: true
schema:
description: ID
minimum: 0
type: integer
responses:
"400":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 请求参数错误
"401":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 未认证或认证已过期
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 无权访问
"500":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 服务器内部错误
security:
- BearerAuth: []
summary: 删除套餐
tags:
- 套餐管理
get:
parameters:
- description: ID
in: path
name: id
required: true
schema:
description: ID
minimum: 0
type: integer
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/DtoPackageResponse'
description: OK
"400":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 请求参数错误
"401":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 未认证或认证已过期
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 无权访问
"500":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 服务器内部错误
security:
- BearerAuth: []
summary: 获取套餐详情
tags:
- 套餐管理
put:
parameters:
- description: ID
in: path
name: id
required: true
schema:
description: ID
minimum: 0
type: integer
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/DtoUpdatePackageParams'
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/DtoPackageResponse'
description: OK
"400":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 请求参数错误
"401":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 未认证或认证已过期
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 无权访问
"500":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 服务器内部错误
security:
- BearerAuth: []
summary: 更新套餐
tags:
- 套餐管理
/api/admin/packages/{id}/shelf:
patch:
parameters:
- description: ID
in: path
name: id
required: true
schema:
description: ID
minimum: 0
type: integer
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/DtoUpdatePackageShelfStatusParams'
responses:
"400":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 请求参数错误
"401":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 未认证或认证已过期
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 无权访问
"500":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 服务器内部错误
security:
- BearerAuth: []
summary: 更新套餐上架状态
tags:
- 套餐管理
/api/admin/packages/{id}/status:
patch:
parameters:
- description: ID
in: path
name: id
required: true
schema:
description: ID
minimum: 0
type: integer
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/DtoUpdatePackageStatusParams'
responses:
"400":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 请求参数错误
"401":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 未认证或认证已过期
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 无权访问
"500":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 服务器内部错误
security:
- BearerAuth: []
summary: 更新套餐状态
tags:
- 套餐管理
/api/admin/password:
put:
requestBody: