This commit is contained in:
2026-02-11 20:12:58 +08:00
parent b424082f01
commit debd0a973f

View File

@@ -187,8 +187,6 @@ func (s *SMSCodeService) GetCodeStatus(ctx context.Context, phone string, scene
// checkRateLimit 检查发送频率限制
func (s *SMSCodeService) CheckRateLimit(ctx context.Context, phone string, scene entities.SMSScene, clientIP, userAgent string) error {
now := time.Now()
// 设备标识(这里使用 User-Agent + IP 的组合做近似设备ID可根据实际情况调整
deviceID := fmt.Sprintf("ua:%s|ip:%s", userAgent, clientIP)
@@ -274,8 +272,6 @@ func (s *SMSCodeService) checkWindowLimit(ctx context.Context, key string, ttl t
// updateSendRecord 更新发送记录
func (s *SMSCodeService) updateSendRecord(ctx context.Context, phone string, scene entities.SMSScene) {
now := time.Now()
// 更新每日计数(用于后续达到上限时永久封禁)
dailyKey := fmt.Sprintf("sms:phone:%s:1d", phone)
var dailyCount int