增加excel模板配置,增加前端导出工具。token迁移至cookie x-token且保留header x-token 两者兼容。

This commit is contained in:
piexlMax
2023-12-30 19:57:36 +08:00
parent 5ea8947fc9
commit cd5b60c8cc
23 changed files with 1275 additions and 38 deletions

View File

@@ -8,7 +8,10 @@ import (
)
func GetClaims(c *gin.Context) (*systemReq.CustomClaims, error) {
token := c.Request.Header.Get("x-token")
token, _ := c.Cookie("x-token")
if token == "" {
token = c.Request.Header.Get("x-token")
}
j := NewJWT()
claims, err := j.ParseToken(token)
if err != nil {

View File

@@ -2,6 +2,7 @@ package utils
import (
"fmt"
"math/rand"
"reflect"
"strings"
)
@@ -65,3 +66,17 @@ func MaheHump(s string) string {
return strings.Join(words, "")
}
// 随机字符串
func RandomString(n int) string {
var letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
b := make([]rune, n)
for i := range b {
b[i] = letters[RandomInt(0, len(letters))]
}
return string(b)
}
func RandomInt(min, max int) int {
return min + rand.Intn(max-min)
}