Feature/user#124
Merged
DevVoyagerNext merged 4 commits intomainfrom Mar 25, 2026
Merged
Conversation
对邮箱标题和内容进行了重构,防止被qq邮箱官方封号。
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 Walkthrough总体流程此次 PR 将 QQ 邮件发送的 Redis 速率限制从单一 1 小时计数器重构为多时间窗口方案,引入 60 秒原子锁保证并发安全,同时将邮件格式升级为 HTML,并扩展邮箱域名验证范围。 变更清单
序列图sequenceDiagram
participant C as 客户端
participant S as 邮件服务
participant R as Redis
C->>S: 发送邮件请求
S->>R: SetNX rate_limit_60s (TTL=60s)
alt 锁获取失败
R-->>S: false (已存在)
S-->>C: ❌ 验证码限流错误
else 锁获取成功
R-->>S: true
S->>R: Get rate_limit_1h
R-->>S: counter_1h
alt 1小时计数 >= 5
S-->>C: ❌ 小时限流错误
else
S->>R: Get rate_limit_24h
R-->>S: counter_24h
alt 24小时计数 >= 10
S-->>C: ❌ 日限流错误
else
S->>S: 发送邮件
alt 发送成功
S->>R: INCR rate_limit_1h
S->>R: INCR rate_limit_24h
S->>R: Set captcha_code
S-->>C: ✅ 成功
else 发送失败
S->>R: DEL rate_limit_60s
S-->>C: ❌ 邮件发送失败
end
end
end
end
代码审查要点✅ 好的实现
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
对发送邮箱验证码的频率限制进行了重构。
对邮箱标题和内容进行了重构,防止被qq邮箱官方封号。
Summary by CodeRabbit
发布说明
新功能
缺陷修复