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