Some checks failed
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Has been cancelled
- 新增 RedisSystemOperationPasswordKey 常量函数(pkg/constants/redis.go) - 新增 operation_password Service(Set/IsSet/Verify,bcrypt 哈希存 Redis) - 新增 SuperAdminHandler 及两个接口: - POST /api/admin/super-admin/operation-password(设置/重置,仅超级管理员) - GET /api/admin/super-admin/operation-password/status(查询是否已设置) - AgentRecharge.OfflinePay 操作密码验证从"查当前用户登录密码"改为"全局操作密码 Verify" - Bootstrap/路由/文档生成器同步注册
35 lines
1.7 KiB
Markdown
35 lines
1.7 KiB
Markdown
## Why
|
||
|
||
系统中需要操作密码验证的接口(如代理充值线下确认)目前使用**当前登录用户自己的登录密码**作为操作密码,缺乏独立的操作层安全机制。需要引入一个**全局操作密码**,仅由超级管理员设置和修改,所有需要操作密码的接口统一验证这一密码,实现"操作密码"与"登录密码"的职责分离。
|
||
|
||
## What Changes
|
||
|
||
- 新增 `POST /api/admin/super-admin/operation-password` 接口:超级管理员设置/修改全局操作密码
|
||
- 新增 `GET /api/admin/super-admin/operation-password/status` 接口:查询操作密码是否已设置
|
||
- 全局操作密码以 bcrypt 哈希值存储于 Redis,Key 定义在 `pkg/constants/redis.go`
|
||
- `agent_recharge` `OfflinePay` 的操作密码验证逻辑从"当前用户登录密码"改为"全局操作密码"
|
||
- 新增统一工具函数 `VerifyOperationPassword(ctx, inputPassword)` 供后续接口复用
|
||
|
||
## Capabilities
|
||
|
||
### New Capabilities
|
||
|
||
- `global-operation-password`:全局操作密码的设置、修改、验证能力,存储于 Redis,仅超级管理员可维护
|
||
|
||
### Modified Capabilities
|
||
|
||
(无已有 spec 变更)
|
||
|
||
## Impact
|
||
|
||
| 层级 | 文件 | 变更类型 |
|
||
|------|------|---------|
|
||
| Handler | `internal/handler/admin/`(新建 `super_admin.go`) | 新建 |
|
||
| Service | `internal/service/`(新建 `operation_password/service.go`) | 新建 |
|
||
| Service | `internal/service/agent_recharge/service.go` | 修改验证逻辑 |
|
||
| Constants | `pkg/constants/redis.go` | 新增 Redis Key 常量 |
|
||
| Bootstrap | `internal/bootstrap/handlers.go`、`services.go` | 注册新组件 |
|
||
| Routes | 路由注册文件 | 新增路由 |
|
||
|
||
**依赖**:Redis(已有,无需新增依赖)
|