登录相关处理

This commit is contained in:
2024-04-09 18:17:08 +08:00
parent 578d7ecdf9
commit 74b790b542
17 changed files with 544 additions and 24 deletions

21
utils/auth/valid_code.go Normal file
View File

@@ -0,0 +1,21 @@
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
}