Files
huangguo_server/common/PromotionCodeUtil.go
T
rootandClaude Opus 5 8679200f41 Initial commit
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-15 13:57:10 +08:00

23 lines
479 B
Go

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
}