This commit is contained in:
2026-01-13 16:12:30 +08:00
parent ba7f219882
commit 2bcbede5cd
8 changed files with 131 additions and 37 deletions

View File

@@ -5,6 +5,7 @@ import (
"encoding/hex"
"encoding/json"
"fmt"
"os"
"time"
"tydata-server/app/main/api/internal/service"
"tydata-server/app/main/model"
@@ -558,6 +559,16 @@ func (l *QueryServiceLogic) DecryptData(data string) ([]byte, error) {
// 校验验证码
func (l *QueryServiceLogic) VerifyCode(mobile string, code string) error {
// 开发环境固定验证码为138888
env := os.Getenv("ENV")
if env == "development" {
if code == "138888" {
logx.Infof("开发环境:验证码验证通过 %s", mobile)
return nil
}
return errors.Wrapf(xerr.NewErrMsg("验证码不正确"), "开发环境验证码应为138888: %s", mobile)
}
secretKey := l.svcCtx.Config.Encrypt.SecretKey
encryptedMobile, err := crypto.EncryptMobile(mobile, secretKey)
if err != nil {