Commit ebfe0db7 authored by haoyanbin's avatar haoyanbin

1

parent 19664050
......@@ -37,7 +37,7 @@ func GetVcode(userId, mocId int) string {
}
func createCode() string {
code := utils.GetRandStr()
code := utils.GetRandStr2()
cid := 0
......
......@@ -135,6 +135,17 @@ func GetPointsOrderNo(num int) string {
return "P" + timeStr + sup(orderNo, 9)
}
func GetRandStr2() string {
charset := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
seededRand := rand.New(rand.NewSource(time.Now().UnixNano()))
b := make([]byte, 6)
for i := range b {
b[i] = charset[seededRand.Intn(len(charset))]
}
return string(b)
}
func GetRandStr() string {
result := make([]byte, 3)
rand.Read(result)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment