feat(shop-role): 实现店铺角色继承功能和权限检查优化
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 6m39s

- 新增店铺角色管理 API 和数据模型
- 实现角色继承和权限检查逻辑
- 添加流程测试框架和集成测试
- 更新权限服务和账号管理逻辑
- 添加数据库迁移脚本
- 归档 OpenSpec 变更文档

Ultraworked with Sisyphus
This commit is contained in:
2026-02-03 10:06:13 +08:00
parent bc7e5d6f6d
commit 5a90caa619
61 changed files with 21284 additions and 131 deletions

View File

@@ -534,6 +534,16 @@ components:
nullable: true
type: array
type: object
DtoAssignShopRolesRequest:
properties:
role_ids:
description: 角色ID列表
items:
minimum: 0
type: integer
nullable: true
type: array
type: object
DtoAuthorizationItem:
properties:
authorized_at:
@@ -3651,6 +3661,39 @@ components:
description: 更新时间
type: string
type: object
DtoShopRoleResponse:
properties:
role_desc:
description: 角色描述
type: string
role_id:
description: 角色ID
minimum: 0
type: integer
role_name:
description: 角色名称
type: string
shop_id:
description: 店铺ID
minimum: 0
type: integer
status:
description: 状态 (0:禁用, 1:启用)
type: integer
type: object
DtoShopRolesResponse:
properties:
roles:
description: 角色列表
items:
$ref: '#/components/schemas/DtoShopRoleResponse'
nullable: true
type: array
shop_id:
description: 店铺ID
minimum: 0
type: integer
type: object
DtoShopSeriesAllocationPageResult:
properties:
list:
@@ -14074,6 +14117,193 @@ paths:
summary: 代理商佣金明细
tags:
- 代理商佣金管理
/api/admin/shops/{shop_id}/roles:
get:
parameters:
- description: 店铺ID
in: path
name: shop_id
required: true
schema:
description: 店铺ID
minimum: 0
type: integer
responses:
"200":
content:
application/json:
schema:
properties:
code:
description: 响应码
example: 0
type: integer
data:
$ref: '#/components/schemas/DtoShopRolesResponse'
msg:
description: 响应消息
example: success
type: string
timestamp:
description: 时间戳
format: date-time
type: string
required:
- code
- msg
- data
- timestamp
type: object
description: 成功
"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:
parameters:
- description: 店铺ID
in: path
name: shop_id
required: true
schema:
description: 店铺ID
minimum: 0
type: integer
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/DtoAssignShopRolesRequest'
responses:
"200":
content:
application/json:
schema:
properties:
code:
description: 响应码
example: 0
type: integer
data:
$ref: '#/components/schemas/DtoShopRolesResponse'
msg:
description: 响应消息
example: success
type: string
timestamp:
description: 时间戳
format: date-time
type: string
required:
- code
- msg
- data
- timestamp
type: object
description: 成功
"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/shops/{shop_id}/roles/{role_id}:
delete:
parameters:
- description: 店铺ID
in: path
name: shop_id
required: true
schema:
description: 店铺ID
minimum: 0
type: integer
- description: 角色ID
in: path
name: role_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:
- 店铺管理
/api/admin/shops/{shop_id}/withdrawal-requests:
get:
parameters: