add: anowflake email kafka, refa: redis connectg
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"fmt"
|
||||
"math/big"
|
||||
)
|
||||
|
||||
func GenCode() string {
|
||||
n, err := rand.Int(rand.Reader, big.NewInt(1000000))
|
||||
if err != nil {
|
||||
return "000000"
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%06d", n.Int64())
|
||||
}
|
||||
Reference in New Issue
Block a user