add oauth loginlog & fix bugs
This commit is contained in:
1 parent
ebd1feb8d1
commit
a4b413dadb
48 files changed
+3477
-184
No files matched your search
@@ -4,6 +4,7 @@ import (
|
||||
"crypto/md5"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"reflect"
|
||||
"runtime/debug"
|
||||
)
|
||||
@@ -61,3 +62,14 @@ func SafeGo(f interface{}, params ...interface{}) {
|
||||
funcValue.Call(paramsValue)
|
||||
}()
|
||||
}
|
||||
|
||||
// RandomString 生成随机字符串
|
||||
func RandomString(n int) string {
|
||||
const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
|
||||
length := len(letterBytes)
|
||||
b := make([]byte, n)
|
||||
for i := range b {
|
||||
b[i] = letterBytes[rand.Intn(length)]
|
||||
}
|
||||
return string(b)
|
||||
}
|
||||
Reference in new issue
Block a user