hi-server/说明文档.md

31 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.

# 说明文档
## 项目规划
检查项目中所有邮件验证码的发送逻辑,确保过期时间统一为 15 分钟。
## 实施方案
1. 搜索整个项目中涉及邮件验证码生成的代码。
2. 搜索项目中涉及验证码存储(如 Redis的代码。
3. 检查过期时间常量或变量,确认是否为 900 秒或 15 分钟。
4. 修复不符合要求的过期时间。
5. 验证修复结果。
## 进度记录
- [2026-01-12 19:58] 启动检查任务,搜索邮件逻辑。
- [2026-01-12 20:10] 完成检查。确认以下文件的验证逻辑均为 15 分钟900秒
- `internal/logic/common/sendEmailCodeLogic.go` (Redis TTL & Template)
- `internal/logic/auth/userRegisterLogic.go` (Explicit Check)
- `internal/logic/auth/resetPasswordLogic.go` (Explicit Check)
- `internal/logic/auth/emailLoginLogic.go` (Explicit Check)
- `internal/logic/public/user/bindEmailWithVerificationLogic.go` (Explicit Check)
- `internal/logic/public/user/verifyEmailLogic.go` (Explicit Check)
- [2026-01-12 20:11] 检查结论:所有邮件验证码发送逻辑均符合 15 分钟过期的要求。
- [2026-01-12 20:35] **统一过期时间配置**
- 修改 `internal/config/config.go` 默认过期时间从 300 秒改为 900 秒
- 修改 `initialize/migrate/database/00002_init_basic_data.up.sql` 初始值从 300 改为 900
- 移除所有逻辑文件中的硬编码 `15``900`,改为使用 `l.svcCtx.Config.VerifyCode.ExpireTime`
- 编译通过,无错误
- [2026-01-13] **设备移出和邀请码优化**
- 修复设备B绑定邮箱后被从设备A移除时未自动退出的问题通过踢出旧连接和清理缓存实现
- 优化邀请码无效时的错误提示,返回 "无邀请码"