Files
junhong_cmp_fiber/openspec/changes/super-admin-operation-password/proposal.md
huang 6caf0f6141
Some checks failed
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Has been cancelled
feat: 新增全局操作密码功能,将线下充值验证从登录密码改为统一操作密码
- 新增 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/路由/文档生成器同步注册
2026-04-18 09:06:33 +08:00

35 lines
1.7 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.
## Why
系统中需要操作密码验证的接口(如代理充值线下确认)目前使用**当前登录用户自己的登录密码**作为操作密码,缺乏独立的操作层安全机制。需要引入一个**全局操作密码**,仅由超级管理员设置和修改,所有需要操作密码的接口统一验证这一密码,实现"操作密码"与"登录密码"的职责分离。
## What Changes
- 新增 `POST /api/admin/super-admin/operation-password` 接口:超级管理员设置/修改全局操作密码
- 新增 `GET /api/admin/super-admin/operation-password/status` 接口:查询操作密码是否已设置
- 全局操作密码以 bcrypt 哈希值存储于 RedisKey 定义在 `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已有无需新增依赖