add limit

This commit is contained in:
Mrx
2026-02-26 13:15:15 +08:00
parent bfbdf983b0
commit ad38f168e8
12 changed files with 175 additions and 19 deletions

View File

@@ -2,10 +2,11 @@ package auth
import (
"context"
"qnc-server/common/xerr"
"qnc-server/pkg/lzkit/crypto"
"fmt"
"math/rand"
"qnc-server/common/xerr"
"qnc-server/pkg/captcha"
"qnc-server/pkg/lzkit/crypto"
"time"
"github.com/pkg/errors"
@@ -35,6 +36,17 @@ func NewSendSmsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SendSmsLo
}
func (l *SendSmsLogic) SendSms(req *types.SendSmsReq) error {
// 1. 滑块验证码校验
cfg := l.svcCtx.Config.Captcha
if err := captcha.Verify(captcha.Config{
AccessKeyID: cfg.AccessKeyID,
AccessKeySecret: cfg.AccessKeySecret,
EndpointURL: cfg.EndpointURL,
SceneID: cfg.SceneID,
}, req.CaptchaVerifyParam); err != nil {
return err
}
secretKey := l.svcCtx.Config.Encrypt.SecretKey
encryptedMobile, err := crypto.EncryptMobile(req.Mobile, secretKey)
if err != nil {