package auth import ( "fmt" "math/rand" ) func GenerateVerificationCode() string { var code string for i := 0; i < 3; i++ { // 生成两个 10-99 之间的随机数 a := rand.Intn(90-10+1) + 10 b := rand.Intn(90-10+1) + 10 c := rand.Intn(90-10+1) + 10 // 将随机数拼接到验证码字符串 code += fmt.Sprintf("%d%d%d", a, b, c) } return code }