增加批量导入资产功能

This commit is contained in:
dushixiang
2021-03-09 23:52:44 +08:00
parent b48f650f7e
commit dc9934bc9e
16 changed files with 273 additions and 23 deletions

View File

@ -55,7 +55,7 @@ func Auth(next echo.HandlerFunc) echo.HandlerFunc {
}
token := GetToken(c)
cacheKey := strings.Join([]string{Token, token}, ":")
cacheKey := BuildCacheKeyByToken(token)
authorization, found := global.Cache.Get(cacheKey)
if !found {
return Fail(c, 401, "您的登录信息已失效,请重新登录后再试。")
@ -63,9 +63,9 @@ func Auth(next echo.HandlerFunc) echo.HandlerFunc {
if authorization.(Authorization).Remember {
// 记住登录有效期两周
global.Cache.Set(token, authorization, time.Hour*time.Duration(24*14))
global.Cache.Set(cacheKey, authorization, time.Hour*time.Duration(24*14))
} else {
global.Cache.Set(token, authorization, time.Hour*time.Duration(2))
global.Cache.Set(cacheKey, authorization, time.Hour*time.Duration(2))
}
return next(c)