Initial commit: 商品售卖网站

This commit is contained in:
2026-04-13 07:20:09 +08:00
commit c6154273f2
865 changed files with 26573 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
package utils
import (
"crypto/rand"
"math/big"
)
func GenerateInviteCode() string {
const charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
code := make([]byte, 8)
for i := range code {
n, _ := rand.Int(rand.Reader, big.NewInt(int64(len(charset))))
code[i] = charset[n.Int64()]
}
return string(code)
}
func GenerateVerifyCode() string {
const charset = "0123456789"
code := make([]byte, 6)
for i := range code {
n, _ := rand.Int(rand.Reader, big.NewInt(int64(len(charset))))
code[i] = charset[n.Int64()]
}
return string(code)
}