add oauth loginlog & fix bugs

This commit is contained in:
ljw
2024-09-19 10:44:49 +08:00
parent ebd1feb8d1
commit a4b413dadb
48 changed files with 3477 additions and 184 deletions

View File

@@ -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)
}