GenRandomCode 生成随机数
(length int)
| 7 | |
| 8 | // GenRandomCode 生成随机数 |
| 9 | func GenRandomCode(length int) string { |
| 10 | letters := []rune("123456789") |
| 11 | code := make([]rune, length) |
| 12 | for i := range code { |
| 13 | code[i] = letters[rand.Intn(len(letters))] |
| 14 | } |
| 15 | return string(code) |
| 16 | } |
| 17 | |
| 18 | // IsValidNumber 检查给定的字符串是否符合中国的手机号格式 |
| 19 | func IsValidNumber(number string) bool { |
no outgoing calls