31 lines
505 B
Go
31 lines
505 B
Go
package channelSer
|
|
|
|
import "math/rand"
|
|
|
|
var (
|
|
//所有的字符
|
|
ALL_CHARS = []string{
|
|
"1", "2", "3", "4", "5",
|
|
"6", "7", "8", "9", "A",
|
|
"B", "C", "D", "E", "F",
|
|
"G", "H", "J", "K",
|
|
"L", "M", "N", "O", "P",
|
|
"Q", "R", "S", "T", "U",
|
|
"V", "W", "X", "Y", "Z"}
|
|
aLen = len(ALL_CHARS)
|
|
)
|
|
|
|
const (
|
|
//默认长度
|
|
DEFAULT_LEN = 6
|
|
)
|
|
|
|
// 用户推广码
|
|
func InviteShartPasswd() (code string) {
|
|
for i := 0; i < DEFAULT_LEN; i++ {
|
|
index := rand.Intn(aLen)
|
|
code += ALL_CHARS[index]
|
|
}
|
|
return
|
|
}
|