fix: 缓存使用redis无法set问题修复&admin账号默认有所有菜单

This commit is contained in:
meilin.huang
2023-10-12 21:50:55 +08:00
parent d300f604f1
commit e0f1f40ba0
14 changed files with 35 additions and 245 deletions

View File

@@ -1,6 +1,7 @@
package cache
import (
"mayfly-go/pkg/biz"
"mayfly-go/pkg/logx"
"mayfly-go/pkg/rediscli"
"strconv"
@@ -20,11 +21,10 @@ func GetStr(key string) string {
return val.(string)
}
res, err := rediscli.Get(key)
if err != nil {
return ""
if res, err := rediscli.Get(key); err == nil {
return res
}
return res
return ""
}
func GetInt(key string) int {
@@ -47,7 +47,7 @@ func SetStr(key, value string, duration time.Duration) {
tm.Add(key, value, duration)
return
}
rediscli.Set(key, value, duration)
biz.ErrIsNilAppendErr(rediscli.Set(key, value, duration), "redis set err: %s")
}
// 删除指定key