This commit is contained in:
Mrx
2026-02-27 12:53:27 +08:00
parent 5089b37ef1
commit fd229f0d59
12 changed files with 223 additions and 6 deletions

View File

@@ -12,6 +12,7 @@ import (
"tyass-server/app/main/api/internal/svc"
"tyass-server/app/main/api/internal/types"
"tyass-server/pkg/captcha"
openapi "github.com/alibabacloud-go/darabonba-openapi/v2/client"
dysmsapi "github.com/alibabacloud-go/dysmsapi-20170525/v3/client"
@@ -35,6 +36,17 @@ func NewSendSmsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SendSmsLo
}
func (l *SendSmsLogic) SendSms(req *types.SendSmsReq) error {
// 图形验证码校验
captchaCfg := l.svcCtx.Config.Captcha
if err := captcha.Verify(captcha.Config{
AccessKeyID: captchaCfg.AccessKeyID,
AccessKeySecret: captchaCfg.AccessKeySecret,
EndpointURL: captchaCfg.EndpointURL,
SceneID: captchaCfg.SceneID,
}, req.CaptchaVerifyParam); err != nil {
return err
}
secretKey := l.svcCtx.Config.Encrypt.SecretKey
encryptedMobile, err := crypto.EncryptMobile(req.Mobile, secretKey)
if err != nil {