@@ -0,0 +1,22 @@
|
||||
package common
|
||||
|
||||
import "math/rand"
|
||||
|
||||
/**
|
||||
* 生成邀请码
|
||||
*/
|
||||
var (
|
||||
//所有的字符
|
||||
allChars = []string{"2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"}
|
||||
//默认长度
|
||||
defaultLen = 6
|
||||
)
|
||||
|
||||
func InvitePromotionCodeGenera() string {
|
||||
result := ""
|
||||
for i := 0; i < defaultLen; i++ {
|
||||
index := rand.Intn(len(allChars))
|
||||
result += allChars[index]
|
||||
}
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user